index.vue 88 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <!-- <el-form-item label="公司名" prop="companyId">-->
  5. <!-- <el-select filterable v-model="queryParams.companyId" placeholder="请选择公司名" @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>-->
  15. <!-- <treeselect style="width: 220px" :clearable="false" v-model="queryParams.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门" />-->
  16. <!-- </el-form-item>-->
  17. <!-- <el-form-item label="订单号" prop="orderCode">
  18. <el-input
  19. v-model="queryParams.orderCode"
  20. placeholder="请输入订单号"
  21. clearable
  22. size="small"
  23. @keyup.enter.native="handleQuery"
  24. />
  25. </el-form-item> -->
  26. <el-form-item label="订单号" prop="orderCodes">
  27. <div class="tag-input-container">
  28. <!-- 标签显示区域 -->
  29. <div class="tags-wrapper" @click="focusInput">
  30. <!-- 已添加的订单号标签 -->
  31. <el-tag
  32. v-for="(code, index) in queryParams.orderCodes"
  33. :key="index"
  34. closable
  35. size="small"
  36. @close="removeOrderCode(index)"
  37. class="order-tag"
  38. :class="{ 'tag-error': false }"
  39. >
  40. {{ code }}
  41. </el-tag>
  42. <!-- 输入框 -->
  43. <el-input
  44. ref="tagInput"
  45. v-model="currentInput"
  46. v-show="inputVisible || queryParams.orderCodes.length === 0"
  47. :placeholder="queryParams.orderCodes.length === 0 ? '请输入订单号,按回车或逗号分隔' : '继续输入...'"
  48. size="small"
  49. class="tag-input"
  50. @keydown.native="handleKeyDown"
  51. @keyup.native="handleKeyUp"
  52. @blur="handleInputConfirm"
  53. @focus="inputVisible = true"
  54. clearable
  55. />
  56. <!-- 添加按钮(当没有输入时显示) -->
  57. <el-button
  58. v-if="!inputVisible && queryParams.orderCodes.length > 0"
  59. class="button-new-tag"
  60. size="small"
  61. @click="showInput"
  62. icon="el-icon-plus"
  63. type="text"
  64. >
  65. 添加订单号
  66. </el-button>
  67. </div>
  68. <!-- 输入提示 -->
  69. <div class="input-tips">
  70. <span class="tip-text">
  71. 支持:回车、逗号、空格分隔 |
  72. 已添加 {{ queryParams.orderCodes.length }} 个订单号
  73. <span v-if="maxOrderCodes > 0"> (最多{{ maxOrderCodes }}个)</span>
  74. </span>
  75. </div>
  76. </div>
  77. </el-form-item>
  78. <el-form-item label="运单号" prop="deliveryId">
  79. <el-input
  80. v-model="queryParams.deliveryId"
  81. placeholder="请输入运单号"
  82. clearable
  83. size="small"
  84. @keyup.enter.native="handleQuery"
  85. />
  86. </el-form-item>
  87. <el-form-item label="产品名称" prop="productName">
  88. <el-input
  89. v-model="queryParams.productName"
  90. placeholder="请输入产品名称"
  91. clearable
  92. size="small"
  93. @keyup.enter.native="handleQuery"
  94. />
  95. </el-form-item>
  96. <el-form-item label="手机号" prop="userPhone">
  97. <el-input
  98. v-model="queryParams.userPhone"
  99. placeholder="请输入手机号"
  100. clearable
  101. size="small"
  102. @keyup.enter.native="handleQuery"
  103. />
  104. </el-form-item>
  105. <el-form-item label="收件人" prop="realName">
  106. <el-input
  107. v-model="queryParams.realName"
  108. placeholder="请输入收件人姓名"
  109. clearable
  110. size="small"
  111. @keyup.enter.native="handleQuery"/>
  112. </el-form-item>
  113. <el-form-item label="员工姓名" prop="companyUserNickName">
  114. <el-input
  115. v-model="queryParams.companyUserNickName"
  116. placeholder="请输入员工姓名"
  117. clearable
  118. size="small"
  119. @keyup.enter.native="handleQuery"
  120. />
  121. </el-form-item>
  122. <el-form-item label="订单类型" prop="orderType">
  123. <el-select v-model="queryParams.orderType" placeholder="请选择订单类型" clearable size="small" >
  124. <el-option
  125. v-for="item in orderTypeOptions"
  126. :key="item.dictValue"
  127. :label="item.dictLabel"
  128. :value="item.dictValue"
  129. />
  130. </el-select>
  131. </el-form-item>
  132. <el-form-item label="支付方式" prop="payType">
  133. <el-select v-model="queryParams.payType" placeholder="请选择支付方式" clearable size="small" >
  134. <el-option
  135. v-for="item in payTypeOptions"
  136. :key="item.dictValue"
  137. :label="item.dictLabel"
  138. :value="item.dictValue"
  139. />
  140. </el-select>
  141. </el-form-item>
  142. <el-form-item label="上传凭证" prop="isUpload">
  143. <el-select v-model="queryParams.isUpload" placeholder="请选择" clearable size="small" >
  144. <el-option key="0" label="未上传" value="0" />
  145. <el-option key="1" label="已上传" value="1" />
  146. </el-select>
  147. </el-form-item>
  148. <el-form-item label="物流状态" prop="deliveryStatus">
  149. <el-select v-model="queryParams.deliveryStatus" placeholder="请选择物流状态" clearable size="small" >
  150. <el-option
  151. v-for="item in deliveryStatusOptions"
  152. :key="item.dictValue"
  153. :label="item.dictLabel"
  154. :value="item.dictValue"
  155. />
  156. </el-select>
  157. </el-form-item>
  158. <el-form-item label="结算状态" prop="deliveryPayStatus">
  159. <el-select v-model="queryParams.deliveryPayStatus" placeholder="请选择物流结算状态" clearable size="small" >
  160. <el-option
  161. v-for="item in deliveryPayStatusOptions"
  162. :key="item.dictValue"
  163. :label="item.dictLabel"
  164. :value="item.dictValue"
  165. />
  166. </el-select>
  167. </el-form-item>
  168. <el-form-item label="小程序" prop="appId">
  169. <el-select v-model="queryParams.appId" placeholder="请选择所属小程序" clearable size="small">
  170. <el-option
  171. v-for="dict in appMallOptions"
  172. :key="dict.appid"
  173. :label="dict.name + '(' + dict.appid + ')'"
  174. :value="dict.appid"
  175. />
  176. </el-select>
  177. </el-form-item>
  178. <el-form-item label="下单时间" prop="createTimeRange">
  179. <el-date-picker
  180. style="width:215px"
  181. clearable size="small"
  182. v-model="createTimeRange"
  183. type="daterange"
  184. value-format="yyyy-MM-dd"
  185. start-placeholder="开始日期"
  186. end-placeholder="结束日期">
  187. </el-date-picker>
  188. </el-form-item>
  189. <el-form-item label="支付时间" prop="payTimeRange">
  190. <el-date-picker
  191. style="width: 215px"
  192. clearable size="small"
  193. v-model="payTimeRange"
  194. type="daterange"
  195. value-format="yyyy-MM-dd"
  196. start-placeholder="开始日期"
  197. end-placeholder="结束日期">
  198. </el-date-picker>
  199. </el-form-item>
  200. <el-form-item label="发货时间" prop="deliverySendTimeRange">
  201. <el-date-picker
  202. style="width:215px"
  203. clearable size="small"
  204. v-model="deliverySendTimeRange"
  205. type="daterange"
  206. value-format="yyyy-MM-dd"
  207. start-placeholder="开始日期"
  208. end-placeholder="结束日期">
  209. </el-date-picker>
  210. </el-form-item>
  211. <el-form-item label="回单时间" prop="deliveryImportTimeRange">
  212. <el-date-picker
  213. style="width:215px"
  214. clearable size="small"
  215. v-model="deliveryImportTimeRange"
  216. type="daterange"
  217. value-format="yyyy-MM-dd"
  218. start-placeholder="开始日期"
  219. end-placeholder="结束日期">
  220. </el-date-picker>
  221. </el-form-item>
  222. <!-- <el-form-item label="档期归属" prop="scheduleId" >-->
  223. <!-- <el-select filterable style="width: 215px" v-model="queryParams.scheduleId" placeholder="请选择档期" clearable size="small" >-->
  224. <!-- <el-option-->
  225. <!-- v-for="item in scheduleOptions"-->
  226. <!-- :key="item.id"-->
  227. <!-- :label="item.name"-->
  228. <!-- :value="item.id"-->
  229. <!-- />-->
  230. <!-- </el-select>-->
  231. <!-- </el-form-item>-->
  232. <el-form-item label="代服账户" prop="erpAccount" v-if="SFDFopen">
  233. <el-select v-model="queryParams.erpAccount" style="width: 215px" placeholder="ERP账户" clearable size="small">
  234. <el-option
  235. v-for="dict in erpAccountQueryList"
  236. :key="dict"
  237. :label="dict"
  238. :value="dict"
  239. />
  240. </el-select>
  241. </el-form-item>
  242. <el-form-item label="代服电话" prop="erpPhoneNumber" v-if="SFDFopen">
  243. <el-input
  244. v-model="queryParams.erpPhoneNumber"
  245. placeholder="ERP电话"
  246. clearable
  247. size="small"
  248. @keyup.enter.native="handleQuery"
  249. />
  250. </el-form-item>
  251. <el-form-item>
  252. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  253. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  254. </el-form-item>
  255. </el-form>
  256. <el-row :gutter="10" class="mb8">
  257. <!-- <el-col :span="1.5">
  258. <el-button
  259. type="primary"
  260. icon="el-icon-plus"
  261. size="mini"
  262. @click="handleAdd"
  263. v-hasPermi="['store:storeOrder:add']"
  264. >创建订单</el-button>
  265. </el-col> -->
  266. <el-col :span="1.5">
  267. <el-button plain type="info" icon="el-icon-upload2" size="mini" @click="handleImport" v-hasPermi="['store:storeOrder:importExpress']">导入银行回单</el-button>
  268. </el-col>
  269. <el-col :span="1.5">
  270. <el-button
  271. type="warning"
  272. icon="el-icon-download"
  273. size="mini"
  274. @click="handleOrderExport"
  275. v-hasPermi="['store:storeOrder:export']"
  276. >导出订单</el-button>
  277. </el-col>
  278. <el-col :span="1.5">
  279. <el-button
  280. type="warning"
  281. icon="el-icon-download"
  282. size="mini"
  283. @click="handleExportItems"
  284. v-hasPermi="['store:storeOrder:exportItems']"
  285. >导出订单明细</el-button>
  286. </el-col>
  287. <el-col :span="1.5">
  288. <el-button
  289. type="warning"
  290. icon="el-icon-s-order"
  291. size="mini"
  292. @click="openDeliveryNote"
  293. >批量导入物流单号</el-button>
  294. </el-col>
  295. <el-col :span="1.5">
  296. <el-button
  297. type="warning"
  298. icon="el-icon-download"
  299. size="mini"
  300. @click="handleExportDetails"
  301. v-hasPermi="['store:storeOrder:export:details']"
  302. >导出订单(明文)</el-button>
  303. </el-col>
  304. <el-col :span="1.5">
  305. <el-button
  306. type="warning"
  307. icon="el-icon-download"
  308. size="mini"
  309. @click="handleExportItemsDetails"
  310. v-hasPermi="['store:storeOrder:exportItems:details']"
  311. >导出订单明细(明文)</el-button>
  312. </el-col>
  313. <el-col :span="1.5">
  314. <el-button
  315. type="danger"
  316. plain
  317. icon="el-icon-delete"
  318. size="mini"
  319. :disabled="multiple"
  320. @click="handleOrderDelete"
  321. v-hasPermi="['store:storeOrder:remove']"
  322. >删除
  323. </el-button>
  324. </el-col>
  325. <el-col :span="1.5" v-if="SFDFopen && orderStatus == 6"> <!--待推送erp-->
  326. <el-tooltip content="默认erp推送手机号" placement="top">
  327. <el-button
  328. type="warning"
  329. plain
  330. icon="el-icon-phone"
  331. size="mini"
  332. @click="handleErpPhone"
  333. v-hasPermi="['store:storeOrder:erpphone']"
  334. >推送手机号码</el-button>
  335. </el-tooltip>
  336. </el-col>
  337. <el-col :span="1.5" v-if="SFDFopen && orderStatus == 6">
  338. <el-tooltip content="批量设置erp推送手机号" placement="top">
  339. <el-button
  340. type="warning"
  341. plain
  342. icon="el-icon-phone"
  343. size="mini"
  344. @click="setErpPhone"
  345. v-hasPermi="['his:storeOrder:createErpOrder']"
  346. >设置推送手机</el-button>
  347. </el-tooltip>
  348. </el-col>
  349. <el-col :span="1.5" v-if="SFDFopen && orderStatus == 6">
  350. <el-tooltip content="批量设置erp账户" placement="top">
  351. <el-button
  352. type="warning"
  353. plain
  354. icon="el-icon-s-cooperation"
  355. size="mini"
  356. @click="showErpAccountSetDialog"
  357. v-hasPermi="['his:storeOrder:createErpOrder']"
  358. >数据分捡</el-button>
  359. </el-tooltip>
  360. </el-col>
  361. <el-col :span="1.5" v-if="SFDFopen && orderStatus == 6">
  362. <el-tooltip content="批量推送erp" placement="top">
  363. <el-button
  364. type="warning"
  365. plain
  366. icon="el-icon-s-cooperation"
  367. size="mini"
  368. @click="showErpAccountDialog"
  369. v-hasPermi="['his:storeOrder:createErpOrder']"
  370. >创建erp</el-button>
  371. </el-tooltip>
  372. </el-col>
  373. <el-col :span="1.5">
  374. <el-button
  375. disabled
  376. plain
  377. type="primary"
  378. size="mini"
  379. >应付金额: {{ payPriceTotal}}</el-button>
  380. </el-col>
  381. <el-col :span="1.5">
  382. <el-button
  383. disabled
  384. plain
  385. type="primary"
  386. size="mini"
  387. >实付金额: {{payMoneyTotal}}</el-button>
  388. </el-col>
  389. <el-col :span="1.5">
  390. <el-button
  391. disabled
  392. plain
  393. type="primary"
  394. size="mini"
  395. >物流代收金额: {{payRemainTotal }}</el-button>
  396. </el-col>
  397. <el-col :span="1.5">
  398. <el-button
  399. disabled
  400. plain
  401. type="primary"
  402. size="mini"
  403. >订单量/金额: {{ total }}/{{payPriceTotal }}</el-button>
  404. </el-col>
  405. <el-col :span="1.5">
  406. <el-input
  407. v-model="orderItemNum"
  408. disabled
  409. size="mini"
  410. />
  411. </el-col>
  412. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  413. </el-row>
  414. <el-tabs type="card" v-model="activeName" @tab-click="handleClick">
  415. <el-tab-pane label="全部订单" name="00"></el-tab-pane>
  416. <el-tab-pane label="待支付" name="0"></el-tab-pane>
  417. <el-tab-pane label="待推送" name="6"></el-tab-pane>
  418. <el-tab-pane label="待发货" name="1"></el-tab-pane>
  419. <el-tab-pane label="待收货" name="2"></el-tab-pane>
  420. <el-tab-pane label="交易完成" name="3"></el-tab-pane>
  421. <el-tab-pane label="退款中" name="-1"></el-tab-pane>
  422. <el-tab-pane label="已退款" name="-2"></el-tab-pane>
  423. <el-tab-pane label="已取消" name="-3"></el-tab-pane>
  424. </el-tabs>
  425. <el-table ref="orderTable" height="500" border v-loading="loading" :data="storeOrderList" @selection-change="handleSelectionChange"
  426. @sort-change="handleSortChange" :default-sort="{prop: 'createTime', order: 'descending'}">
  427. <el-table-column type="selection" width="55" align="center" />
  428. <el-table-column label="订单号" align="center" prop="orderCode" width="200px" />
  429. <el-table-column label="ERP电话" align="center" prop="erpPhone" width="120px" v-if="SFDFopen "/>
  430. <el-table-column label="ERP账号" align="center" prop="erpAccount" width="120px" v-if="SFDFopen"/>
  431. <el-table-column label="所属公司" align="center" prop="companyName" />
  432. <el-table-column label="所属员工" align="center" prop="companyUserNickName" width="120px" 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="小程序名称" width="120px" align="center" prop="miniProgramName"/>
  439. <el-table-column label="用户昵称" align="center" prop="nickname" width="150px" >
  440. <template slot-scope="scope">
  441. <span>{{scope.row.nickname}} </span>
  442. </template>
  443. </el-table-column>
  444. <el-table-column label="收件人" align="center" prop="realName" width="150px" >
  445. <template slot-scope="scope">
  446. <span>{{scope.row.realName}} </span>
  447. </template>
  448. </el-table-column>
  449. <!-- <el-table-column label="商品" align="center" width="300px" >
  450. <template slot-scope="scope">
  451. <div v-for="(item, index) in scope.row.items" class="items" >
  452. <img class="pic" :src="JSON.parse(item.jsonInfo).image" />
  453. <div class="goods-content">
  454. <div class="goods-title">{{ JSON.parse(item.jsonInfo).productName}}</div>
  455. <div class="sku">{{ JSON.parse(item.jsonInfo).sku}}</div>
  456. <div class="price">¥{{JSON.parse(item.jsonInfo).price}}×{{item.num}}</div>
  457. </div>
  458. </div>
  459. </template>
  460. </el-table-column> -->
  461. <el-table-column label="订单金额" align="center" prop="totalPrice" >
  462. <template slot-scope="scope">
  463. <span v-if="scope.row.totalPrice!=null">{{scope.row.totalPrice.toFixed(2)}}</span>
  464. </template>
  465. </el-table-column>
  466. <!-- <el-table-column label="应付金额" align="center" prop="payPrice" >
  467. <template slot-scope="scope">
  468. <span v-if="scope.row.payPrice!=null">{{scope.row.payPrice.toFixed(2)}}</span>
  469. </template>
  470. </el-table-column> -->
  471. <el-table-column label="应付金额" align="center" prop="payPrice" width="100px" sortable="custom" :sort-orders="['ascending', 'descending']">
  472. <template slot="header" slot-scope="scope">
  473. <span >应收金额</span>
  474. <el-tooltip content="按应收金额排序" placement="top"/>
  475. </template>
  476. </el-table-column>
  477. <el-table-column label="实付金额" align="center" prop="payMoney" >
  478. <template slot="header" slot-scope="scope">
  479. <span>实收金额</span>
  480. <el-tooltip content="按实收金额排序" placement="top"/>
  481. </template>
  482. </el-table-column>
  483. <el-table-column label="物流代收金额" align="center" prop="payDelivery" >
  484. <template slot-scope="scope">
  485. <span v-if="scope.row.payPrice!=null">{{scope.row.payDelivery.toFixed(2)}}</span>
  486. </template>
  487. </el-table-column>
  488. <el-table-column label="下单时间" align="center" prop="createTime" />
  489. <!-- <el-table-column label="支付状态" align="center" prop="paid" /> -->
  490. <el-table-column label="支付时间" align="center" prop="payTime" width="180" />
  491. <el-table-column label="发货时间" align="center" prop="deliverySendTime" width="180"></el-table-column>
  492. <el-table-column label="支付方式" align="center" prop="payType" >
  493. <template slot-scope="scope">
  494. <el-tag prop="payType" v-for="(item, index) in payTypeOptions" v-if="scope.row.payType==item.dictValue">{{item.dictLabel}}</el-tag>
  495. </template>
  496. </el-table-column>
  497. <el-table-column label="订单类型" align="center" prop="orderType" >
  498. <template slot-scope="scope">
  499. <el-tag prop="orderType" v-for="(item, index) in orderTypeOptions" v-if="scope.row.orderType==item.dictValue">{{item.dictLabel}}</el-tag>
  500. </template>
  501. </el-table-column>
  502. <el-table-column label="媒体来源" align="center" prop="orderMedium" >
  503. <template slot-scope="scope">
  504. <el-tag prop="orderMedium" v-for="(item, index) in orderMediumOptions" v-if="scope.row.orderMedium==item.dictValue">{{item.dictLabel}}</el-tag>
  505. </template>
  506. </el-table-column>
  507. <el-table-column label="产品名称" align="center" width="200px">
  508. <template slot-scope="scope">
  509. <div v-if="scope.row.items && scope.row.items.length > 0">
  510. <el-tag
  511. v-for="(item, index) in scope.row.items"
  512. :key="index"
  513. size="mini"
  514. class="product-tag"
  515. >
  516. {{ JSON.parse(item.jsonInfo).productName }} × {{ item.num }}
  517. </el-tag>
  518. </div>
  519. <span v-else class="no-products">暂无商品</span>
  520. </template>
  521. </el-table-column>
  522. <el-table-column label="状态" align="center" prop="status" >
  523. <template slot-scope="scope">
  524. <el-tag prop="status" v-for="(item, index) in statusOptions" v-if="scope.row.status==item.dictValue">{{item.dictLabel}}</el-tag>
  525. </template>
  526. </el-table-column>
  527. <el-table-column label="运单号" align="center" prop="deliveryId" >
  528. </el-table-column>
  529. <el-table-column label="物流状态" align="center" prop="deliveryStatus" >
  530. <template slot-scope="scope">
  531. <el-tag prop="status" v-for="(item, index) in deliveryStatusOptions" v-if="scope.row.deliveryStatus==item.dictValue">{{item.dictLabel}}</el-tag>
  532. </template>
  533. </el-table-column>
  534. <el-table-column label="物流结算状态" align="center" prop="deliveryPayStatus" >
  535. <template slot-scope="scope">
  536. <el-tag prop="status" v-for="(item, index) in deliveryPayStatusOptions" v-if="scope.row.deliveryPayStatus==item.dictValue">{{item.dictLabel}}</el-tag>
  537. </template>
  538. </el-table-column>
  539. <el-table-column label="操作" fixed="right" width="80px" align="center" class-name="small-padding fixed-width">
  540. <template slot-scope="scope">
  541. <el-button
  542. size="mini"
  543. type="text"
  544. @click="handleDetails(scope.row)"
  545. v-hasPermi="['store:storeOrder:query']"
  546. >查看</el-button>
  547. <!-- <el-button
  548. size="mini"
  549. type="text"
  550. @click="handleGenPayUrl(scope.row)"
  551. v-hasPermi="['store:storeOrder:genPayUrl']"
  552. >生成付款链接</el-button> -->
  553. </template>
  554. </el-table-column>
  555. </el-table>
  556. <div>
  557. 商品数量合计:{{ productInfo }}
  558. </div>
  559. <!-- 排序状态显示 -->
  560. <div v-if="currentSort.prop" class="sort-info">
  561. <el-tag size="small" type="info" closable @close="clearSort">
  562. <i class="el-icon-sort"></i>
  563. 当前排序:{{ getSortLabel(currentSort.prop) }}
  564. {{ currentSort.order === 'ascending' ? '升序' : '降序' }}
  565. </el-tag>
  566. <el-button
  567. type="text"
  568. size="mini"
  569. @click="clearSort"
  570. style="margin-left: 8px; color: #909399;"
  571. >
  572. </el-button>
  573. </div>
  574. <pagination
  575. v-show="total>0"
  576. :total="total"
  577. :page.sync="queryParams.pageNum"
  578. :limit.sync="queryParams.pageSize"
  579. @pagination="getList"
  580. />
  581. <el-drawer size="75%" :title="show.title" :visible.sync="show.open">
  582. <product-order ref="order" />
  583. </el-drawer>
  584. <el-dialog :title="title" v-if="open" :visible.sync="open" width="1000px" append-to-body>
  585. <el-form ref="form" :model="form" :rules="rules" label-width="120px">
  586. <el-form-item label="会员信息" prop="userId">
  587. <el-row >
  588. <el-col >
  589. <el-input placeholder="请输入会员手机号" style="width:240px;cursor:pointer" v-model="phone">
  590. </el-input>
  591. <el-button plain style="margin-left:10px;" @click="searchUser()">查询</el-button>
  592. <el-button plain style="margin-left:10px;" icon="el-icon-plus" type="primary" @click="handleAddUser()">添加会员</el-button>
  593. </el-col>
  594. </el-row>
  595. <el-table border style="margin-top:5px;" v-loading="userloading" :data="users">
  596. <el-table-column label="ID" align="center" prop="userId" />
  597. <el-table-column label="会员头像" align="center" width="80">
  598. <template slot-scope="scope">
  599. <el-popover
  600. placement="right"
  601. title=""
  602. trigger="hover"
  603. >
  604. <img slot="reference" :src="scope.row.avatar" width="50" >
  605. <img :src="scope.row.avatar" style="max-width: 120px;">
  606. </el-popover>
  607. </template>
  608. </el-table-column>
  609. <el-table-column label="昵称" align="center" prop="nickname" />
  610. <el-table-column label="手机号" align="center" prop="phone" />
  611. <el-table-column label="状态" align="center" prop="status" >
  612. <template slot-scope="scope">
  613. <el-tag prop="status" v-for="(item, index) in userStatusOptions" v-if="scope.row.status==item.dictValue">{{item.dictLabel}}</el-tag>
  614. </template>
  615. </el-table-column>
  616. </el-table>
  617. </el-form-item>
  618. <el-form-item label="收货信息" prop="addressId">
  619. <el-row >
  620. <el-col >
  621. <el-button plain type="primary" icon="el-icon-plus" @click="handleAddUserAddress()">添加收货地址</el-button>
  622. </el-col>
  623. </el-row>
  624. <el-radio-group v-model="form.addressId" style="width:100%">
  625. <el-table border style="margin-top:5px;" v-loading="addressloading" :data="address">
  626. <el-table-column label="ID" align="center" >
  627. <template slot-scope="scope">
  628. <el-radio :label="scope.row.id"></el-radio>
  629. </template>
  630. </el-table-column>
  631. <el-table-column label="收货人姓名" align="center" prop="realName" />
  632. <el-table-column label="收货人电话" align="center" prop="phone" />
  633. <el-table-column label="地址" align="center" prop="detail" >
  634. <template slot-scope="scope">
  635. {{scope.row.province}} {{scope.row.city}} {{scope.row.district}} {{scope.row.detail}}
  636. </template>
  637. </el-table-column>
  638. </el-table>
  639. </el-radio-group>
  640. </el-form-item>
  641. <el-form-item label="商品列表" >
  642. <el-row >
  643. <el-col >
  644. <el-button plain type="primary" icon="el-icon-plus" @click="handleAddProduct">添加商品</el-button>
  645. </el-col>
  646. </el-row>
  647. <el-table border :key = "tablekey" width="100%" style="margin-top:5px;" :data="products">
  648. <el-table-column label="商品编号" align="center" prop="barCode" />
  649. <el-table-column label="商品图片" align="center" width="100">
  650. <template slot-scope="scope">
  651. <el-popover
  652. placement="right"
  653. title=""
  654. trigger="hover"
  655. >
  656. <img slot="reference" :src="scope.row.image" width="50">
  657. <img :src="scope.row.image" style="max-width: 50px;">
  658. </el-popover>
  659. </template>
  660. </el-table-column>
  661. <el-table-column label="产品名称" show-overflow-tooltip align="center" prop="productName" />
  662. <el-table-column label="商品规格" align="center" prop="sku" />
  663. <el-table-column label="库存" align="center" prop="stock" />
  664. <el-table-column label="单价" align="center" prop="price" />
  665. <el-table-column label="数量" align="center" prop="count" width="200px" :key="tablekey">
  666. <template slot-scope="scope">
  667. <div>
  668. <el-input-number v-model="scope.row.count" @change="handleProductCountChange(scope.row)" size="mini" :min="1" :max="scope.row.stock" ></el-input-number>
  669. </div>
  670. </template>
  671. </el-table-column>
  672. <el-table-column label="小计" align="center" prop="money" />
  673. <el-table-column label="操作" align="center" width="100px" >
  674. <template slot-scope="scope">
  675. <el-button
  676. size="mini"
  677. type="text"
  678. icon="el-icon-delete"
  679. @click="handleDelete(scope.row)"
  680. >删除</el-button>
  681. </template>
  682. </el-table-column>
  683. </el-table>
  684. <el-row>
  685. <el-col>
  686. <span>商品合计:{{products.length}}</span><span style="margin-left:10px;">商品总价:{{totalMoney.toFixed(2)}}</span>
  687. </el-col>
  688. </el-row>
  689. </el-form-item>
  690. <el-form-item label="订单备注" prop="mark">
  691. <el-input type="textarea" rows="2" v-model="form.mark" placeholder="" />
  692. </el-form-item>
  693. </el-form>
  694. <div slot="footer" class="dialog-footer">
  695. <el-button type="primary" @click="submitForm">确 定</el-button>
  696. <el-button @click="cancel">取 消</el-button>
  697. </div>
  698. </el-dialog>
  699. <el-dialog :title="product.title" v-if="product.open" :visible.sync="product.open" width="1000px" append-to-body>
  700. <product-select @selectProduct="selectProduct" />
  701. </el-dialog>
  702. <el-dialog :title="user.title" v-if="user.open" :visible.sync="user.open" width="500px" append-to-body>
  703. <add-user @addUser="addUser" />
  704. </el-dialog>
  705. <el-dialog :title="userAddress.title" v-if="userAddress.open" :visible.sync="userAddress.open" width="800px" append-to-body>
  706. <add-user-address ref="addUserAddress" @addUserAddress="addUserAddress" />
  707. </el-dialog>
  708. <el-dialog :title="payQr.title" v-if="payQr.open" :visible.sync="payQr.open" width="240px" append-to-body>
  709. <div style="padding-bottom:15px;" >
  710. <div class="qrcode" ref="qrCodeUrl"></div>
  711. </div>
  712. </el-dialog>
  713. <el-dialog :title="upload.title" :visible.sync="upload.open" append-to-body width="400px">
  714. <el-upload ref="upload" :action="upload.url + '?updateSupport=' + upload.updateSupport" :auto-upload="false" :disabled="upload.isUploading"
  715. :headers="upload.headers" :limit="1"
  716. :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" accept=".xlsx, .xls" drag
  717. >
  718. <i class="el-icon-upload"></i>
  719. <div class="el-upload__text">
  720. 将文件拖到此处,或
  721. <em>点击上传</em>
  722. </div>
  723. <div slot="tip" class="el-upload__tip">
  724. <!-- <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的数据 -->
  725. <el-link
  726. style="font-size:12px"
  727. type="info"
  728. id="templateDownloadLink"
  729. >
  730. 下载模板
  731. </el-link>
  732. </div>
  733. <div slot="tip" class="el-upload__tip" style="color:red">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
  734. </el-upload>
  735. <div slot="footer" class="dialog-footer">
  736. <el-button type="primary" @click="submitFileForm">确 定</el-button>
  737. <el-button @click="upload.open = false">取 消</el-button>
  738. </div>
  739. </el-dialog>
  740. <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="importMsgOpen"
  741. append-to-body title="导入结果" width="500px"
  742. >
  743. <h1>{{importMsg}}</h1>
  744. </el-dialog>
  745. <!-- 批量发货 -->
  746. <el-dialog
  747. :before-close="handleClose"
  748. :visible.sync="deliveryNoteOpen"
  749. center
  750. title="批量发货"
  751. width="35%"
  752. >
  753. <span slot="footer" class="dialog-footer">
  754. <!-- 小程序Appid选择 -->
  755. <!-- <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">-->
  756. <!-- <el-form-item label="小程序:" prop="miniAppId">-->
  757. <!-- <el-select-->
  758. <!-- v-model="ruleForm.miniAppId"-->
  759. <!-- clearable-->
  760. <!-- placeholder="请选择发货小程序"-->
  761. <!-- style="width: 100%"-->
  762. <!-- >-->
  763. <!-- <el-option-->
  764. <!-- v-for="item in miniAppList"-->
  765. <!-- :key="item.appId"-->
  766. <!-- :label="item.appName"-->
  767. <!-- :value="item.appId"-->
  768. <!-- />-->
  769. <!-- </el-select>-->
  770. <!-- </el-form-item>-->
  771. <!-- </el-form>-->
  772. <el-upload ref="upload" :action="orderUpload.url" :auto-upload="false" :disabled="orderUpload.isUploading" :headers="orderUpload.headers"
  773. :limit="1" :on-progress="handleFileUploadProgress"
  774. :on-success="handleFileSuccess" accept=".xlsx, .xls" drag
  775. >
  776. <i class="el-icon-upload"></i>
  777. <div class="el-upload__text">
  778. 将文件拖到此处,或
  779. <em>点击上传</em>
  780. </div>
  781. <div slot="tip" class="el-upload__tip">
  782. <el-link
  783. type="info"
  784. id="templateDownloadLink"
  785. @click.prevent="importDeliveryNoteTemplate"
  786. >
  787. 下载模板
  788. </el-link>
  789. </div>
  790. <div slot="tip" class="el-upload__tip" style="color:red">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
  791. </el-upload>
  792. <el-divider></el-divider>
  793. <el-button @click="deliveryNoteOpen = false">取 消</el-button>
  794. <el-button type="primary" @click="submitDeliveryNote">确 定</el-button>
  795. </span>
  796. </el-dialog>
  797. <!-- 设置推送手机对话框 -->
  798. <el-dialog :title="erpPhone.title" :visible.sync="erpPhone.open" width="600px" append-to-body>
  799. <div style="margin-bottom: 20px;">
  800. <el-button type="primary" size="small" @click="handleAddPhone">新增手机号</el-button>
  801. </div>
  802. <el-table :data="phoneList" border style="width: 100%">
  803. <el-table-column prop="phone" label="手机号" align="center">
  804. <template slot-scope="scope">
  805. <el-input
  806. v-if="scope.row.editing"
  807. v-model="scope.row.phone"
  808. placeholder="请输入手机号"
  809. @blur="validatePhone(scope.row)"
  810. @keyup.enter.native="handleSavePhone(scope.$index)"
  811. />
  812. <span v-else>{{ scope.row.phone }}</span>
  813. </template>
  814. </el-table-column>
  815. <el-table-column label="操作" align="center" width="300">
  816. <template slot-scope="scope">
  817. <el-button
  818. v-if="scope.row.editing"
  819. type="success"
  820. size="mini"
  821. @click="handleSavePhone(scope.$index)"
  822. >保存</el-button>
  823. <el-button
  824. v-if="scope.row.editing"
  825. type="info"
  826. size="mini"
  827. @click="handleCancelEdit(scope.$index)"
  828. >取消</el-button>
  829. <el-button
  830. v-if="!scope.row.editing"
  831. type="primary"
  832. size="mini"
  833. @click="handleEditPhone(scope.$index)"
  834. >修改</el-button>
  835. <el-button
  836. type="danger"
  837. size="mini"
  838. @click="handleDeletePhone(scope.$index)"
  839. >删除</el-button>
  840. </template>
  841. </el-table-column>
  842. </el-table>
  843. <div slot="footer" class="dialog-footer">
  844. <el-button type="primary" @click="handleSavePhoneList">确 定</el-button>
  845. <el-button @click="handleCancelPhoneDialog">取 消</el-button>
  846. </div>
  847. </el-dialog>
  848. <el-dialog :title="erpPhone.title" :visible.sync="setPhoneOpen" width="600px" append-to-body>
  849. <el-select v-model="erpPhoneValue" multiple placeholder="请选择">
  850. <el-option
  851. v-for="item in phoneList"
  852. :key="item.phone"
  853. :label="item.phone"
  854. :value="item.phone">
  855. </el-option>
  856. </el-select>
  857. <div slot="footer" class="dialog-footer">
  858. <el-button type="primary" @click="submitErpPhone">确 定</el-button>
  859. <el-button @click="handleCancelErpPhone">取 消</el-button>
  860. </div>
  861. </el-dialog>
  862. <!-- ERP账户选择对话框 -->
  863. <el-dialog :title="erpAccountDialog.title" :visible.sync="erpAccountDialog.open" width="600px" append-to-body>
  864. <div v-loading="erpAccountDialog.loading">
  865. <el-form :model="erpAccountForm" label-width="100px">
  866. <el-form-item label="ERP账户" required>
  867. <el-select
  868. v-model="erpAccountForm.selectedAccount"
  869. placeholder="请选择ERP账户"
  870. style="width: 100%"
  871. filterable
  872. >
  873. <el-option
  874. v-for="account in erpAccountList"
  875. :key="account"
  876. :label="account"
  877. :value="account"
  878. >
  879. <span style="float: left">{{ account}}</span>
  880. <span style="float: right; color: #8492a6; font-size: 13px">{{ account.accountCode }}</span>
  881. </el-option>
  882. </el-select>
  883. </el-form-item>
  884. </el-form>
  885. <!-- 订单统计信息 -->
  886. <div class="order-summary" v-if="orderSummary">
  887. <el-divider content-position="left">订单统计</el-divider>
  888. <el-row :gutter="20">
  889. <el-col :span="8">
  890. <div class="summary-item">
  891. <span class="label">选中订单数:</span>
  892. <span class="value">{{ orderSummary.selectedCount }}</span>
  893. </div>
  894. </el-col>
  895. <el-col :span="8">
  896. <div class="summary-item">
  897. <span class="label">总金额:</span>
  898. <span class="value">¥{{ orderSummary.totalAmount }}</span>
  899. </div>
  900. </el-col>
  901. <el-col :span="8">
  902. <div class="summary-item">
  903. <span class="label">查询条件订单:</span>
  904. <span class="value">{{ orderSummary.queryCount }}</span>
  905. </div>
  906. </el-col>
  907. </el-row>
  908. </div>
  909. </div>
  910. <div slot="footer" class="dialog-footer">
  911. <el-button @click="cancelErpAccountDialog">取 消</el-button>
  912. <el-button
  913. type="primary"
  914. @click="confirmCreateErpOrder"
  915. :disabled="!erpAccountForm.selectedAccount"
  916. :loading="erpAccountDialog.submitting"
  917. >确认</el-button>
  918. </div>
  919. </el-dialog>
  920. <!-- 导出字段选择对话框 -->
  921. <el-dialog :title="exportFieldDialog.title" :visible.sync="exportFieldDialog.open" width="800px" append-to-body>
  922. <div v-loading="exportFieldDialog.loading">
  923. <div style="margin-bottom: 20px;">
  924. <el-button type="primary" size="small" @click="selectAllFields">全选</el-button>
  925. <el-button type="default" size="small" @click="unselectAllFields">全不选</el-button>
  926. <el-button type="success" size="small" @click="selectDefaultFields">选择常用</el-button>
  927. </div>
  928. <div class="field-selection-container">
  929. <el-row :gutter="20">
  930. <el-col :span="8" v-for="field in exportFieldOptions" :key="field.key">
  931. <el-checkbox
  932. v-model="field.checked"
  933. :label="field.label"
  934. style="margin-bottom: 12px; width: 100%;"
  935. >
  936. {{ field.label }}
  937. </el-checkbox>
  938. </el-col>
  939. </el-row>
  940. </div>
  941. <div class="field-count-info" style="margin-top: 20px; padding: 10px; background: #f5f7fa; border-radius: 4px;">
  942. <i class="el-icon-info"></i>
  943. <span v-if="getSelectedFieldsCount() > 0">
  944. 已选择 <span style="color: #409EFF; font-weight: bold;">{{ getSelectedFieldsCount() }}</span> 个字段
  945. </span>
  946. <span v-else style="color: #E6A23C; font-weight: bold;">
  947. <i class="el-icon-warning"></i>
  948. 未选择任何字段,将导出所有字段
  949. </span>
  950. </div>
  951. </div>
  952. <div slot="footer" class="dialog-footer">
  953. <el-button @click="cancelExportFieldDialog">取 消</el-button>
  954. <el-button
  955. type="primary"
  956. @click="confirmExportFields"
  957. >确认导出</el-button>
  958. </div>
  959. </el-dialog>
  960. </div>
  961. </template>
  962. <script>
  963. import {
  964. importTemplate,
  965. exportStoreOrderItems,
  966. createUserOrder,
  967. listStoreOrder,
  968. getStoreOrder,
  969. delStoreOrder,
  970. addStoreOrder,
  971. updateStoreOrder,
  972. exportStoreOrder,
  973. getOrderItemsNum,
  974. importDeliveryNoteExpressTemplate, exportStoreOrderDetails, exportStoreOrderItemsDetails,getErpAccount,
  975. queryErpPhone,
  976. saveErpPhone,editErpPhone,batchCreateErpOrder,batchSetErpOrder
  977. } from '@/api/hisStore/storeOrder'
  978. import { getUserList } from "@/api/hisStore/user";
  979. import { getAddressList } from "@/api/hisStore/userAddress";
  980. import productOrder from "../components/productOrder";
  981. import productSelect from "../components/productSelect";
  982. import addUser from "../components/addUser";
  983. import addUserAddress from "../components/addUserAddress";
  984. import { getToken } from "@/utils/auth";
  985. import QRCode from 'qrcodejs2'
  986. import { getCompanyList } from "@/api/company/company";
  987. // import { getTcmScheduleList } from "@/api/company/schedule";
  988. import { treeselect } from "@/api/company/companyDept";
  989. import Treeselect from "@riophae/vue-treeselect";
  990. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  991. import { getConfigByKey } from '@/api/system/config'
  992. import {list as getAppMallOptions} from '@/api/course/coursePlaySourceConfig';
  993. export default {
  994. components: { productOrder,productSelect,addUser,addUserAddress,Treeselect },
  995. name: "HisStoreOrder",
  996. watch: {
  997. // 监听deptId
  998. 'deptId': 'currDeptChange'
  999. },
  1000. data() {
  1001. return {
  1002. orderStatus:null,
  1003. productInfo:"",
  1004. payPriceTotal:"0",
  1005. payMoneyTotal:"0",
  1006. payRemainTotal:"0",
  1007. // 新增排序相关数据
  1008. currentSort: {
  1009. prop: null,
  1010. order: null
  1011. },
  1012. // 排序字段映射
  1013. sortFieldMap: {
  1014. 'companyUserName': '员工',
  1015. 'packageName': '套餐名称',
  1016. 'payPrice': '应收金额',
  1017. 'payMoney': '实收金额',
  1018. 'createTime': '下单时间'
  1019. },
  1020. erpSettingType:'set',
  1021. SFDFopen:false,
  1022. // 最大订单号数量限制
  1023. maxOrderCodes: {
  1024. type: Number,
  1025. default: 50
  1026. },
  1027. // 输入框是否可见
  1028. inputVisible: false,
  1029. // 无效订单号对话框
  1030. showInvalidDialog: false,
  1031. // 当前输入值
  1032. currentInput: '',
  1033. deptOpen:true,
  1034. // ERP账户相关数据
  1035. erpAccountDialog: {
  1036. open: false,
  1037. title: "选择ERP账户",
  1038. loading: false,
  1039. submitting: false
  1040. },
  1041. erpAccountList: [], // ERP账户列表
  1042. erpAccountQueryList:[], // ERP账户查询条件列表
  1043. erpAccountForm: {
  1044. selectedAccount: [] // 选中的账户ID
  1045. },
  1046. orderSummary: null, // 订单统计信息
  1047. erpPhoneValue:[],
  1048. setPhoneOpen:false,
  1049. erpPhone:{
  1050. open:false,
  1051. title:"设置推送手机号"
  1052. },
  1053. phoneList: [], // 手机号列表
  1054. originalPhoneList: [], // 原始手机号列表,用于取消时恢复
  1055. exportFieldDialog: {
  1056. open: false,
  1057. title: "选择导出字段",
  1058. loading: false,
  1059. type:null
  1060. },
  1061. // 可选择的导出字段列表
  1062. exportFieldOptions: [
  1063. { key: 'orderCode', label: '订单号', checked: true },
  1064. { key: 'miniProgramName', label: '小程序名称', checked: true },
  1065. { key: 'companyName', label: '公司名称', checked: true },
  1066. { key: 'companyUserNickName', label: '所属销售', checked: true },
  1067. { key: 'patientName', label: '就诊人', checked: true },
  1068. { key: 'productName', label: '编号', checked: true },
  1069. { key: 'barCode', label: '药品信息', checked: false },
  1070. { key: 'payMoney', label: '实收金额', checked: true },
  1071. { key: 'payRemain', label: '物流代收金额', checked: false },
  1072. { key: 'payType', label: '支付方式', checked: true },
  1073. { key: 'createTime', label: '下单时间', checked: true },
  1074. { key: 'payTime', label: '支付时间', checked: true },
  1075. { key: 'status', label: '订单状态', checked: true },
  1076. { key: 'userName', label: '收货人姓名', checked: true },
  1077. { key: 'userPhone', label: '收货人电话', checked: true },
  1078. { key: 'userAddress', label: '详细地址', checked: true },
  1079. { key: 'deliveryCode', label: '快递公司编号', checked: false },
  1080. { key: 'deliveryName', label: '快递公司', checked: false },
  1081. { key: 'deliverySn', label: '快递单号', checked: false },
  1082. { key: 'remark', label: '备注', checked: false },
  1083. { key: 'erpPhone', label: 'ERP电话', checked: false },
  1084. { key: 'erpAccount', label: 'ERP账号', checked: false },
  1085. ],
  1086. itemlist : [],
  1087. importMsgOpen:false,
  1088. importMsg:"",
  1089. scheduleOptions:[],
  1090. deliveryPayStatusOptions:[],
  1091. deliveryStatusOptions:[],
  1092. companys:[],
  1093. deptOptions:[],
  1094. companyId:undefined,
  1095. deptId:undefined,
  1096. orderMediumOptions:[],
  1097. orderTypeOptions:[],
  1098. payTypeOptions:[],
  1099. appMallOptions:[],
  1100. payQr:{
  1101. open:false,
  1102. title:"付款二维码"
  1103. },
  1104. user:{
  1105. open:false,
  1106. title:"创建会员"
  1107. },
  1108. userAddress:{
  1109. open:false,
  1110. title:"创建收货地址"
  1111. },
  1112. tablekey:false,
  1113. totalMoney:0.00,
  1114. products:[],
  1115. product:{
  1116. open:false,
  1117. title:"商品选择"
  1118. },
  1119. userStatusOptions:[],
  1120. phone:null,
  1121. address:[],
  1122. addressloading: false,
  1123. userloading: false,
  1124. users:[],
  1125. show:{
  1126. open:false,
  1127. title:"订单详情"
  1128. },
  1129. activeName:"00",
  1130. statusOptions:[],
  1131. // 遮罩层
  1132. loading: true,
  1133. // 选中数组
  1134. ids: [],
  1135. // 非单个禁用
  1136. single: true,
  1137. // 非多个禁用
  1138. multiple: true,
  1139. // 显示搜索条件
  1140. showSearch: true,
  1141. // 总条数
  1142. total: 0,
  1143. // 订单表格数据
  1144. storeOrderList: [],
  1145. // 弹出层标题
  1146. title: "",
  1147. // 是否显示弹出层
  1148. open: false,
  1149. createTimeRange:[],
  1150. payTimeRange:[],
  1151. deliveryImportTimeRange:[],
  1152. deliverySendTimeRange:[],
  1153. orderItemNum:"",
  1154. // 查询参数
  1155. queryParams: {
  1156. pageNum: 1,
  1157. pageSize: 10,
  1158. orderCode: null,
  1159. orderCodes:[],
  1160. extendOrderId: null,
  1161. userId: null,
  1162. realName: null,
  1163. userPhone: null,
  1164. userAddress: null,
  1165. cartId: null,
  1166. freightPrice: null,
  1167. totalNum: null,
  1168. totalPrice: null,
  1169. totalPostage: null,
  1170. payPrice: null,
  1171. payPostage: null,
  1172. deductionPrice: null,
  1173. couponId: null,
  1174. couponPrice: null,
  1175. paid: null,
  1176. payTime: null,
  1177. payType: null,
  1178. status: null,
  1179. refundStatus: null,
  1180. refundReasonWapImg: null,
  1181. refundReasonWapExplain: null,
  1182. refundReasonTime: null,
  1183. refundReasonWap: null,
  1184. refundReason: null,
  1185. refundPrice: null,
  1186. deliverySn: null,
  1187. deliveryName: null,
  1188. deliveryType: null,
  1189. deliveryId: null,
  1190. gainIntegral: null,
  1191. useIntegral: null,
  1192. payIntegral: null,
  1193. backIntegral: null,
  1194. mark: null,
  1195. isDel: null,
  1196. cost: null,
  1197. verifyCode: null,
  1198. storeId: null,
  1199. shippingType: null,
  1200. isChannel: null,
  1201. isRemind: null,
  1202. isSysDel: null,
  1203. deptId:null,
  1204. isUpload:null,
  1205. productName:null,
  1206. },
  1207. // 表单参数
  1208. form: {
  1209. addressId:null,
  1210. userId:null,
  1211. },
  1212. // 表单校验
  1213. rules: {
  1214. userId: [
  1215. { required: true, message: "会员信息不能为空" }
  1216. ],
  1217. addressId: [
  1218. { required: true, message: "收货信息不能为空" }
  1219. ],
  1220. },
  1221. upload: {
  1222. // 是否显示弹出层(用户导入)
  1223. open: false,
  1224. // 弹出层标题(用户导入)
  1225. title: "",
  1226. // 是否禁用上传
  1227. isUploading: false,
  1228. // 是否更新已经存在的用户数据
  1229. updateSupport: 0,
  1230. // 设置上传的请求头部
  1231. headers: { Authorization: "Bearer " + getToken() },
  1232. // 上传的地址
  1233. url: process.env.VUE_APP_BASE_API + "/store/storeOrder/importExpress",
  1234. },
  1235. orderUpload: {
  1236. // 是否显示弹出层(用户导入)
  1237. open: false,
  1238. // 弹出层标题(用户导入)
  1239. title: '',
  1240. // 是否禁用上传
  1241. isUploading: false,
  1242. // 是否更新已经存在的用户数据
  1243. updateSupport: 0,
  1244. // 设置上传的请求头部
  1245. headers: { Authorization: 'Bearer ' + getToken() },
  1246. // 上传的地址
  1247. url: process.env.VUE_APP_BASE_API + '/store/store/storeOrder/importDeliveryNoteExpress',
  1248. },
  1249. deliveryNoteOpen:false,
  1250. miniAppList: [],
  1251. ruleForm:{
  1252. miniAppId: null,
  1253. },
  1254. };
  1255. },
  1256. created() {
  1257. // getCompanyList().then(response => {
  1258. // this.companys = response.data;
  1259. // if(this.companys!=null&&this.companys.length>0){
  1260. // this.companyId=this.companys[0].companyId;
  1261. // this.getTreeselect();
  1262. // }
  1263. // });
  1264. if(process.env.NODE_ENV === "prod-hst"){
  1265. this.getDicts("store_order_medium").then((response) => {
  1266. this.orderMediumOptions = response.data;
  1267. });
  1268. } else {
  1269. this.getDicts("crm_customer_source").then((response) => {
  1270. this.orderMediumOptions = response.data;
  1271. });
  1272. }
  1273. this.getDicts("store_order_type").then((response) => {
  1274. this.orderTypeOptions = response.data;
  1275. });
  1276. this.getDicts("user_status").then((response) => {
  1277. this.userStatusOptions = response.data;
  1278. });
  1279. this.getDicts("store_pay_type").then((response) => {
  1280. this.payTypeOptions = response.data;
  1281. });
  1282. this.getDicts("store_order_status").then((response) => {
  1283. this.statusOptions = response.data;
  1284. });
  1285. this.getDicts("store_order_delivery_status").then((response) => {
  1286. this.deliveryStatusOptions = response.data;
  1287. });
  1288. this.getDicts("store_delivery_pay_status").then((response) => {
  1289. this.deliveryPayStatusOptions = response.data;
  1290. });
  1291. this.getList();
  1292. this.getItemsNum();
  1293. this.getErpAccountList();
  1294. this.getAppMallOptions();
  1295. },
  1296. methods: {
  1297. // 新增排序处理方法
  1298. handleSortChange({ column, prop, order }) {
  1299. console.log('排序变化:', { column, prop, order });
  1300. // 更新当前排序状态
  1301. this.currentSort = {
  1302. prop: prop,
  1303. order: order
  1304. };
  1305. // 更新查询参数
  1306. if (order) {
  1307. this.queryParams.sortField = prop;
  1308. this.queryParams.sortOrder = order === 'ascending' ? 'asc' : 'desc';
  1309. } else {
  1310. this.queryParams.sortField = null;
  1311. this.queryParams.sortOrder = null;
  1312. }
  1313. // 重新查询数据
  1314. this.queryParams.pageNum = 1; // 重置到第一页
  1315. this.getList();
  1316. // 显示排序提示
  1317. if (order) {
  1318. const fieldLabel = this.getSortLabel(prop);
  1319. const orderLabel = order === 'ascending' ? '升序' : '降序';
  1320. this.$message.success(`已按${fieldLabel}${orderLabel}排序`);
  1321. }
  1322. },
  1323. // 获取排序字段的中文标签
  1324. getSortLabel(prop) {
  1325. return this.sortFieldMap[prop] || prop;
  1326. },
  1327. // 清除排序
  1328. clearSort() {
  1329. this.currentSort = {
  1330. prop: null,
  1331. order: null
  1332. };
  1333. this.queryParams.sortField = null;
  1334. this.queryParams.sortOrder = null;
  1335. this.queryParams.pageNum = 1;
  1336. // 重置表格排序状态 - 关键代码
  1337. this.$nextTick(() => {
  1338. if (this.$refs.orderTable) {
  1339. this.$refs.orderTable.clearSort();
  1340. }
  1341. });
  1342. this.getList();
  1343. this.$message.success('已清除排序');
  1344. },
  1345. // 处理键盘按下事件
  1346. handleKeyDown(event) {
  1347. const { key, target } = event
  1348. // 处理退格键删除标签
  1349. if (key === 'Backspace' && !target.value && this.queryParams.orderCodes.length > 0) {
  1350. event.preventDefault()
  1351. this.removeOrderCode(this.queryParams.orderCodes.length - 1)
  1352. }
  1353. // 处理分隔符
  1354. if ([',', ',', ' ', 'Enter'].includes(key)) {
  1355. event.preventDefault()
  1356. this.handleInputConfirm()
  1357. }
  1358. },
  1359. // 处理键盘抬起事件(实时分割输入)
  1360. handleKeyUp(event) {
  1361. const value = event.target.value
  1362. // 检查是否包含分隔符
  1363. if (/[,,\s]/.test(value)) {
  1364. this.handleInputConfirm()
  1365. }
  1366. },
  1367. // 确认输入
  1368. handleInputConfirm() {
  1369. const inputValue = this.currentInput.trim()
  1370. if (inputValue) {
  1371. // 分割多个订单号
  1372. const codes = inputValue.split(/[,,\s]+/).filter(code => code.trim())
  1373. codes.forEach(code => {
  1374. this.addOrderCode(code.trim())
  1375. })
  1376. }
  1377. this.currentInput = ''
  1378. },
  1379. // 添加订单号
  1380. addOrderCode(code) {
  1381. if (!code) return
  1382. // 检查数量限制
  1383. if (this.maxOrderCodes > 0 && this.queryParams.orderCodes.length >= this.maxOrderCodes) {
  1384. this.$message.warning(`最多只能添加 ${this.maxOrderCodes} 个订单号`)
  1385. return
  1386. }
  1387. // 检查重复
  1388. if (this.queryParams.orderCodes.includes(code)) {
  1389. this.$message.warning(`订单号 "${code}" 已存在`)
  1390. return
  1391. }
  1392. // 添加到列表
  1393. this.queryParams.orderCodes.push(code)
  1394. },
  1395. // 清空所有标签
  1396. clearAllTags() {
  1397. this.$confirm('确认清空所有订单号吗?', '提示', {
  1398. confirmButtonText: '确定',
  1399. cancelButtonText: '取消',
  1400. type: 'warning'
  1401. }).then(() => {
  1402. this.queryParams.orderCodes = []
  1403. this.$message.success('已清空所有订单号')
  1404. })
  1405. },
  1406. // 显示输入框
  1407. showInput() {
  1408. this.inputVisible = true
  1409. this.$nextTick(() => {
  1410. this.$refs.tagInput.focus()
  1411. })
  1412. },
  1413. // 删除订单号
  1414. removeOrderCode(index) {
  1415. this.queryParams.orderCodes.splice(index, 1)
  1416. },
  1417. // 聚焦输入框
  1418. focusInput() {
  1419. if (!this.inputVisible) {
  1420. this.showInput()
  1421. }
  1422. },
  1423. // 设置erp账户
  1424. showErpAccountSetDialog() {
  1425. this.erpAccountDialog.open = true;
  1426. this.erpSettingType = 'set'
  1427. this.calculateOrderSummary();
  1428. },
  1429. //显示ERP账户选择对话框
  1430. showErpAccountDialog() {
  1431. this.erpAccountDialog.open = true;
  1432. this.erpSettingType = 'push'
  1433. this.calculateOrderSummary();
  1434. },
  1435. //获取ERP账户列表
  1436. async getErpAccountList() {
  1437. try {
  1438. const response = await getErpAccount();
  1439. if (response.code === 200) {
  1440. const list = response.data || [];
  1441. this.erpAccountList = [...list];
  1442. this.erpAccountQueryList = [...list, '未分拣'];
  1443. // 设置默认值:第一条真实账户
  1444. if (list.length && !this.queryParams.erpAccount) {
  1445. this.$set(this.queryParams, 'erpAccount', list[0]);
  1446. this.getList();
  1447. }
  1448. } else {
  1449. this.$message.error(response.msg || '获取ERP账户列表失败');
  1450. this.erpAccountList = [];
  1451. }
  1452. } catch (error) {
  1453. console.error('获取ERP账户列表失败:', error);
  1454. this.$message.error('获取ERP账户列表失败');
  1455. this.erpAccountList = [];
  1456. } finally {
  1457. this.erpAccountDialog.loading = false;
  1458. }
  1459. },
  1460. // 新增:计算订单统计信息
  1461. calculateOrderSummary() {
  1462. let selectedCount = 0;
  1463. let totalAmount = 0;
  1464. let queryCount = this.total || 0;
  1465. if (this.ids.length > 0) {
  1466. // 如果有选中的订单,统计选中的订单
  1467. selectedCount = this.ids.length;
  1468. this.storeOrderList.forEach(order => {
  1469. if (this.ids.includes(order.orderId)) {
  1470. totalAmount += parseFloat(order.payMoney || 0);
  1471. }
  1472. });
  1473. } else {
  1474. // 如果没有选中订单,统计当前查询条件下的所有订单
  1475. selectedCount = queryCount;
  1476. this.storeOrderList.forEach(order => {
  1477. totalAmount += parseFloat(order.payMoney || 0);
  1478. });
  1479. }
  1480. this.orderSummary = {
  1481. selectedCount,
  1482. totalAmount: totalAmount.toFixed(2),
  1483. queryCount
  1484. };
  1485. },
  1486. //确认创建ERP订单
  1487. confirmCreateErpOrder() {
  1488. if (!this.erpAccountForm.selectedAccount) {
  1489. this.$message.warning('请选择ERP账户');
  1490. return;
  1491. }
  1492. console.log("-----------------",this.erpSettingType)
  1493. if(this.erpSettingType == 'set'){
  1494. this.$confirm(
  1495. `确认将订单设置ERP账户为"${this.erpAccountForm.selectedAccount}"吗?`,
  1496. '确认',
  1497. {
  1498. confirmButtonText: '确定',
  1499. cancelButtonText: '取消',
  1500. type: 'warning'
  1501. }
  1502. ).then(() => {
  1503. this.executSetErpOrder();
  1504. });
  1505. } else if(this.erpSettingType == 'push'){
  1506. this.$confirm(
  1507. `确认将订单推送到ERP账户"${this.erpAccountForm.selectedAccount}"吗?`,
  1508. '确认推送',
  1509. {
  1510. confirmButtonText: '确定推送',
  1511. cancelButtonText: '取消',
  1512. type: 'warning'
  1513. }
  1514. ).then(() => {
  1515. this.executeCreateErpOrder();
  1516. });
  1517. }
  1518. },
  1519. async executSetErpOrder() {
  1520. this.erpAccountDialog.submitting = true;
  1521. try {
  1522. let param = {
  1523. loginAccount: this.erpAccountForm.selectedAccount
  1524. };
  1525. if (this.ids.length > 0) {
  1526. // 如果有选中的订单,只推送选中的
  1527. param.orderIds = this.ids;
  1528. } else {
  1529. // 如果没有选中订单,推送查询条件下的所有订单
  1530. // 合并查询参数
  1531. param = { ...param, ...this.queryParams };
  1532. }
  1533. const response = await batchSetErpOrder(param);
  1534. if (response.code === 200) {
  1535. this.$message.success('订单ERP账号设置成功');
  1536. this.cancelErpAccountDialog();
  1537. this.getErpAccountList(); // 刷新列表
  1538. this.getList();
  1539. } else {
  1540. this.$message.error(response.msg || 'ERP账号设置失败');
  1541. }
  1542. } catch (error) {
  1543. console.error('ERP账号设置失败:', error);
  1544. this.$message.error('ERP账号设置失败');
  1545. } finally {
  1546. this.erpAccountDialog.submitting = false;
  1547. }
  1548. },
  1549. //执行创建ERP订单
  1550. async executeCreateErpOrder() {
  1551. this.erpAccountDialog.submitting = true;
  1552. try {
  1553. let param = {
  1554. loginAccount: this.erpAccountForm.selectedAccount
  1555. };
  1556. if (this.ids.length > 0) {
  1557. // 如果有选中的订单,只推送选中的
  1558. param.orderIds = this.ids;
  1559. } else {
  1560. // 如果没有选中订单,推送查询条件下的所有订单
  1561. // 合并查询参数
  1562. param = { ...param, ...this.queryParams };
  1563. }
  1564. const response = await batchCreateErpOrder(param);
  1565. if (response.code === 200) {
  1566. this.$message.success('ERP订单创建成功');
  1567. this.cancelErpAccountDialog();
  1568. this.getErpAccountList(); // 刷新列表
  1569. this.getList();
  1570. } else {
  1571. this.$message.error(response.msg || 'ERP订单创建失败');
  1572. }
  1573. } catch (error) {
  1574. console.error('创建ERP订单失败:', error);
  1575. this.$message.error('创建ERP订单失败');
  1576. } finally {
  1577. this.erpAccountDialog.submitting = false;
  1578. }
  1579. },
  1580. // 新增:取消ERP账户选择对话框
  1581. cancelErpAccountDialog() {
  1582. this.erpAccountDialog.open = false;
  1583. this.erpAccountForm.selectedAccount = null;
  1584. this.orderSummary = null;
  1585. this.erpAccountList = [];
  1586. },
  1587. handleCancelErpPhone(){
  1588. this.erpPhoneValue = [];
  1589. this.setPhoneOpen = false;
  1590. },
  1591. submitErpPhone(){
  1592. let param = {};
  1593. if(this.ids.length>0){
  1594. param = {orderIds:this.ids,erpPhone:this.erpPhoneValue};
  1595. } else {
  1596. param = this.queryParams;
  1597. param.erpPhone=this.erpPhoneValue;
  1598. }
  1599. editErpPhone(param).then(response=>{
  1600. this.msgSuccess("修改成功");
  1601. this.setPhoneOpen = false;
  1602. this.getList();
  1603. })
  1604. },
  1605. setErpPhone(){
  1606. this.getErpPhoneList();
  1607. this.setPhoneOpen = true;
  1608. },
  1609. // 设置推送手机相关方法
  1610. handleErpPhone(){
  1611. //查询配置手机号
  1612. this.getErpPhoneList();
  1613. this.erpPhone.open = true
  1614. },
  1615. getErpPhoneList(){
  1616. queryErpPhone().then(response =>{
  1617. if(response.data && response.data != null && response.data.length >0){
  1618. const phones = response.data.filter(phone => phone.trim());
  1619. this.phoneList = phones.map(phone => ({
  1620. phone: phone.trim(),
  1621. editing: false,
  1622. originalPhone: phone.trim()
  1623. }));
  1624. }
  1625. // 保存原始数据用于取消操作
  1626. this.originalPhoneList = this.phoneList;
  1627. });
  1628. },
  1629. // 新增手机号
  1630. handleAddPhone() {
  1631. this.phoneList.push({
  1632. phone: '',
  1633. editing: true,
  1634. originalPhone: '',
  1635. isNew: true
  1636. });
  1637. },
  1638. // 编辑手机号
  1639. handleEditPhone(index) {
  1640. this.$set(this.phoneList[index], 'editing', true);
  1641. this.$set(this.phoneList[index], 'originalPhone', this.phoneList[index].phone);
  1642. },
  1643. // 保存手机号
  1644. handleSavePhone(index) {
  1645. const phone = this.phoneList[index].phone.trim();
  1646. if (!phone) {
  1647. this.$message.error('手机号不能为空');
  1648. return;
  1649. }
  1650. if (!this.validatePhoneFormat(phone)) {
  1651. this.$message.error('请输入正确的手机号格式');
  1652. return;
  1653. }
  1654. // 检查是否重复
  1655. const duplicateIndex = this.phoneList.findIndex((item, idx) =>
  1656. idx !== index && item.phone === phone
  1657. );
  1658. if (duplicateIndex !== -1) {
  1659. this.$message.error('手机号已存在');
  1660. return;
  1661. }
  1662. this.$set(this.phoneList[index], 'editing', false);
  1663. this.$set(this.phoneList[index], 'isNew', false);
  1664. },
  1665. // 取消编辑
  1666. handleCancelEdit(index) {
  1667. if (this.phoneList[index].isNew) {
  1668. // 如果是新增的,直接删除
  1669. this.phoneList.splice(index, 1);
  1670. } else {
  1671. // 如果是编辑的,恢复原值
  1672. this.$set(this.phoneList[index], 'phone', this.phoneList[index].originalPhone);
  1673. this.$set(this.phoneList[index], 'editing', false);
  1674. }
  1675. },
  1676. // 删除手机号
  1677. handleDeletePhone(index) {
  1678. this.$confirm('确认删除该手机号?', '提示', {
  1679. confirmButtonText: '确定',
  1680. cancelButtonText: '取消',
  1681. type: 'warning'
  1682. }).then(() => {
  1683. this.phoneList.splice(index, 1);
  1684. this.$message.success('删除成功');
  1685. });
  1686. },
  1687. // 验证手机号格式
  1688. validatePhoneFormat(phone) {
  1689. const phoneRegex = /^1[3-9]\d{9}$/;
  1690. return phoneRegex.test(phone);
  1691. },
  1692. // 验证手机号
  1693. validatePhone(row) {
  1694. if (row.phone && !this.validatePhoneFormat(row.phone)) {
  1695. this.$message.error('请输入正确的手机号格式');
  1696. }
  1697. },
  1698. // 保存手机号列表
  1699. handleSavePhoneList() {
  1700. // 检查是否有正在编辑的项
  1701. const editingItem = this.phoneList.find(item => item.editing);
  1702. if (editingItem) {
  1703. this.$message.error('请先保存正在编辑的手机号');
  1704. return;
  1705. }
  1706. // 检查是否有空的手机号
  1707. const emptyPhone = this.phoneList.find(item => !item.phone.trim());
  1708. if (emptyPhone) {
  1709. this.$message.error('存在空的手机号,请删除或填写完整');
  1710. return;
  1711. }
  1712. // 构造手机号列表
  1713. const phoneList = this.phoneList.map(item => item.phone);
  1714. // 调用保存接口
  1715. saveErpPhone(phoneList).then(response => {
  1716. if (response.code === 200) {
  1717. this.$message.success('保存成功');
  1718. this.erpPhone.open = false;
  1719. } else {
  1720. this.$message.error(response.msg || '保存失败');
  1721. }
  1722. this.getList();
  1723. }).catch(() => {
  1724. this.$message.error('保存失败');
  1725. });
  1726. },
  1727. // 取消手机号对话框
  1728. handleCancelPhoneDialog() {
  1729. // 恢复原始数据
  1730. this.phoneList = JSON.parse(JSON.stringify(this.originalPhoneList));
  1731. this.erpPhone.open = false;
  1732. },
  1733. // 获取小程序选项列表
  1734. getAppMallOptions() {
  1735. getAppMallOptions({pageNum:1,pageSize:100,isMall:1}).then(response => {
  1736. this.appMallOptions = response.rows;
  1737. })
  1738. },
  1739. // 获取已选择字段数量
  1740. getSelectedFieldsCount() {
  1741. return this.exportFieldOptions.filter(field => field.checked).length;
  1742. },
  1743. // 取消导出字段选择
  1744. cancelExportFieldDialog() {
  1745. this.exportFieldDialog.open = false;
  1746. this.exportFieldDialog.type = null;
  1747. },
  1748. // 选择常用字段
  1749. selectDefaultFields() {
  1750. // 先全不选
  1751. this.unselectAllFields();
  1752. // 然后选择常用字段
  1753. const defaultFields = ['orderCode', 'prescribeCode', 'companyName', 'companyUserNickName',
  1754. 'storeName', 'miniProgramName', 'userName', 'userPhone', 'userAddress', 'totalPrice',
  1755. 'totalNum', 'payPrice', 'payMoney', 'createTime', 'payTime',
  1756. 'payType', 'status', 'packageName', 'patientName'];
  1757. this.exportFieldOptions.forEach(field => {
  1758. if (defaultFields.includes(field.key)) {
  1759. field.checked = true;
  1760. }
  1761. });
  1762. },
  1763. // 确认导出字段
  1764. confirmExportFields() {
  1765. // 获取已选择的字段
  1766. const selectedFieldsArray = this.exportFieldOptions.filter(field => field.checked);
  1767. let selectedFields = '';
  1768. if (selectedFieldsArray.length === 0) {
  1769. // 如果没有选择任何字段,则导出全部字段(不传filter参数)
  1770. selectedFields = null;
  1771. } else {
  1772. // 如果选择了字段,则只导出选中的字段
  1773. selectedFields = selectedFieldsArray.map(field => field.key).join(',');
  1774. }
  1775. // 关闭弹窗
  1776. this.exportFieldDialog.open = false;
  1777. // 执行导出操作
  1778. this.doExportOrder(selectedFields);
  1779. },
  1780. // 执行导出操作
  1781. doExportOrder(selectedFields) {
  1782. if(this.queryParams.status=='00'){
  1783. this.queryParams.status=null;
  1784. }
  1785. if(this.createTimeRange!=null&&this.createTimeRange.length==2){
  1786. this.queryParams.createTimeRange=this.createTimeRange[0]+"--"+this.createTimeRange[1]
  1787. }
  1788. else{
  1789. this.queryParams.createTimeRange=null;
  1790. }
  1791. if(this.payTimeRange!=null&&this.payTimeRange.length==2){
  1792. this.queryParams.payTimeRange=this.payTimeRange[0]+"--"+this.payTimeRange[1]
  1793. }
  1794. else{
  1795. this.queryParams.payTimeRange=null;
  1796. }
  1797. if(this.deliveryImportTimeRange!=null&&this.deliveryImportTimeRange.length==2){
  1798. this.queryParams.deliveryImportTimeRange=this.deliveryImportTimeRange[0]+"--"+this.deliveryImportTimeRange[1]
  1799. }
  1800. else{
  1801. this.queryParams.deliveryImportTimeRange=null;
  1802. }
  1803. if(this.deliverySendTimeRange!=null&&this.deliverySendTimeRange.length==2){
  1804. this.queryParams.deliverySendTimeRange=this.deliverySendTimeRange[0]+"--"+this.deliverySendTimeRange[1]
  1805. }
  1806. else{
  1807. this.queryParams.deliverySendTimeRange=null;
  1808. }
  1809. const queryParams = this.addDateRange(this.queryParams, this.dateRange);
  1810. // 根据是否选择字段显示不同的确认消息
  1811. let confirmMessage = '';
  1812. if (selectedFields === null) {
  1813. confirmMessage = '没有选择字段,将导出所有字段的订单数据,确认继续?';
  1814. } else {
  1815. const fieldCount = selectedFields.split(',').length;
  1816. confirmMessage = `确认导出选中的 ${fieldCount} 个字段的订单数据?`;
  1817. }
  1818. this.$confirm('是否确认导出所有订单数据项?', "警告", {
  1819. confirmButtonText: "确定",
  1820. cancelButtonText: "取消",
  1821. type: "warning"
  1822. }).then(()=> {
  1823. this.exportLoading = true;
  1824. // 构建请求参数
  1825. const requestParams = {...queryParams};
  1826. // 只有当selectedFields不为null时才添加filter参数
  1827. if (selectedFields !== null) {
  1828. requestParams.filter = selectedFields;
  1829. }
  1830. console.log(requestParams)
  1831. if(this.exportFieldDialog.type == 1){
  1832. return exportStoreOrder(requestParams);
  1833. } else if (this.exportFieldDialog.type == 2){
  1834. return exportStoreOrderDetails(requestParams);
  1835. }
  1836. }).then(response => {
  1837. this.download(response.msg);
  1838. }).catch(function() {});
  1839. },
  1840. // 导出字段选择相关方法
  1841. // 全选字段
  1842. selectAllFields() {
  1843. this.exportFieldOptions.forEach(field => {
  1844. field.checked = true;
  1845. });
  1846. },
  1847. // 全不选字段
  1848. unselectAllFields() {
  1849. this.exportFieldOptions.forEach(field => {
  1850. field.checked = false;
  1851. });
  1852. },
  1853. handleGenPayUrl(row){
  1854. this.payQr.open=true;
  1855. setTimeout(() => {
  1856. var qrcode = new QRCode(this.$refs.qrCodeUrl, {
  1857. text: config.payQRUrl+row.id, // 需要转换为二维码的内容
  1858. width: 200,
  1859. height: 200,
  1860. colorDark: '#000000',
  1861. colorLight: '#ffffff',
  1862. correctLevel: QRCode.CorrectLevel.H
  1863. })
  1864. }, 200);
  1865. },
  1866. handleAddUser(){
  1867. this.user.open=true;
  1868. },
  1869. handleAddUserAddress(){
  1870. if(this.form.userId==null){
  1871. this.msgError("请选择会员");
  1872. return;
  1873. }
  1874. this.userAddress.open=true;
  1875. setTimeout(() => {
  1876. this.$refs.addUserAddress.init(this.form.userId);
  1877. }, 500);
  1878. },
  1879. addUser(){
  1880. this.user.open=false;
  1881. },
  1882. addUserAddress(){
  1883. this.userAddress.open=false;
  1884. //获取地址
  1885. this.getAddressList(this.form.userId);
  1886. },
  1887. compute(){
  1888. this.totalMoney=0;
  1889. var that=this;
  1890. this.products.forEach (function (value) {
  1891. that.totalMoney += value.money;
  1892. });
  1893. console.log(that.totalMoney)
  1894. },
  1895. handleProductCountChange(row){
  1896. this.tablekey = !this.tablekey
  1897. console.log(row)
  1898. row.money=row.count*row.price;
  1899. this.$forceUpdate();
  1900. this.compute();
  1901. },
  1902. selectProduct(row){
  1903. console.log(row);
  1904. for(var i=0;i<this.products.length;i++){
  1905. if(this.products[i].id==row.id){
  1906. return;
  1907. }
  1908. }
  1909. row.count=1;
  1910. row.money=row.count*row.price;
  1911. this.products.push(row);
  1912. this.compute();
  1913. },
  1914. handleAddProduct(){
  1915. this.product.open=true;
  1916. },
  1917. searchUser(){
  1918. if(this.phone==null||this.phone==""){
  1919. return;
  1920. }
  1921. var data={phone:this.phone}
  1922. this.userloading = true;
  1923. this.users=[];
  1924. this.address=[];
  1925. getUserList(data).then(response => {
  1926. this.users = response.data;
  1927. this.userloading = false;
  1928. if(this.users!=null&&this.users.length==1){
  1929. this.form.userId=this.users[0].userId;
  1930. this.getAddressList(this.form.userId)
  1931. }
  1932. });
  1933. },
  1934. getAddressList(userId){
  1935. var data={userId:userId}
  1936. this.addressloading = true;
  1937. this.address=[];
  1938. getAddressList(data).then(response => {
  1939. this.address = response.data;
  1940. this.addressloading = false;
  1941. });
  1942. },
  1943. handleDetails(row){
  1944. this.show.open=true;
  1945. const orderId = row.id ;
  1946. setTimeout(() => {
  1947. this.$refs.order.getOrder(orderId);
  1948. }, 500);
  1949. },
  1950. handleClick(tab, event) {
  1951. this.orderStatus = tab.name;
  1952. this.activeName=tab.name;
  1953. this.queryParams.status=tab.name
  1954. console.log(this.queryParams.status)
  1955. this.getList();
  1956. },
  1957. /** 查询订单列表 */
  1958. getList() {
  1959. this.loading = true;
  1960. if(this.queryParams.status=='00'){
  1961. this.queryParams.status=null;
  1962. }
  1963. if(this.createTimeRange!=null&&this.createTimeRange.length==2){
  1964. this.queryParams.createTimeRange=this.createTimeRange[0]+"--"+this.createTimeRange[1]
  1965. }
  1966. else{
  1967. this.queryParams.createTimeRange=null;
  1968. }
  1969. if(this.payTimeRange!=null&&this.payTimeRange.length==2){
  1970. this.queryParams.payTimeRange=this.payTimeRange[0]+"--"+this.payTimeRange[1]
  1971. }
  1972. else{
  1973. this.queryParams.payTimeRange=null;
  1974. }
  1975. if(this.deliveryImportTimeRange!=null&&this.deliveryImportTimeRange.length==2){
  1976. this.queryParams.deliveryImportTimeRange=this.deliveryImportTimeRange[0]+"--"+this.deliveryImportTimeRange[1]
  1977. }
  1978. else{
  1979. this.queryParams.deliveryImportTimeRange=null;
  1980. }
  1981. if(this.deliverySendTimeRange!=null&&this.deliverySendTimeRange.length==2){
  1982. this.queryParams.deliverySendTimeRange=this.deliverySendTimeRange[0]+"--"+this.deliverySendTimeRange[1]
  1983. }
  1984. else{
  1985. this.queryParams.deliverySendTimeRange=null;
  1986. }
  1987. // 处理订单号数组
  1988. if (this.queryParams.orderCodes && this.queryParams.orderCodes.length > 0) {
  1989. this.queryParams.orderCodeList = this.queryParams.orderCodes.join(',');
  1990. } else {
  1991. this.queryParams.orderCodeList = null;
  1992. }
  1993. listStoreOrder(this.queryParams).then(response => {
  1994. this.storeOrderList = response.rows;
  1995. this.total = response.total;
  1996. if(this.total>0){
  1997. this.payPriceTotal = response.payPriceTotal;
  1998. this.payMoneyTotal = response.payMoneyTotal;
  1999. this.payRemainTotal = response.payRemainTotal;
  2000. this.productInfo = response.productInfo;
  2001. } else {
  2002. this.payPriceTotal = "0"
  2003. this.payMoneyTotal = "0"
  2004. this.payRemainTotal = "0"
  2005. this.productInfo = response.productInfo;
  2006. }
  2007. this.loading = false;
  2008. if(response.msg == 'knt'){
  2009. this.SFDFopen = true;
  2010. } else{
  2011. this.SFDFopen = false;
  2012. }
  2013. // 如果有排序,显示排序结果提示
  2014. if (this.currentSort.prop) {
  2015. const fieldLabel = this.getSortLabel(this.currentSort.prop);
  2016. const orderLabel = this.currentSort.order === 'ascending' ? '升序' : '降序';
  2017. console.log(`数据已按${fieldLabel}${orderLabel}加载`);
  2018. }
  2019. }).catch(error => {
  2020. console.error('查询失败:', error);
  2021. this.loading = false;
  2022. this.$message.error('查询数据失败');
  2023. });
  2024. },
  2025. getItemsNum() {
  2026. this.loading = true;
  2027. if(this.queryParams.status=='00'){
  2028. this.queryParams.status=null;
  2029. }
  2030. if(this.createTimeRange!=null&&this.createTimeRange.length==2){
  2031. this.queryParams.createTimeRange=this.createTimeRange[0]+"--"+this.createTimeRange[1]
  2032. }
  2033. else{
  2034. this.queryParams.createTimeRange=null;
  2035. }
  2036. if(this.payTimeRange!=null&&this.payTimeRange.length==2){
  2037. this.queryParams.payTimeRange=this.payTimeRange[0]+"--"+this.payTimeRange[1]
  2038. }
  2039. else{
  2040. this.queryParams.payTimeRange=null;
  2041. }
  2042. if(this.deliveryImportTimeRange!=null&&this.deliveryImportTimeRange.length==2){
  2043. this.queryParams.deliveryImportTimeRange=this.deliveryImportTimeRange[0]+"--"+this.deliveryImportTimeRange[1]
  2044. }
  2045. else{
  2046. this.queryParams.deliveryImportTimeRange=null;
  2047. }
  2048. if(this.deliverySendTimeRange!=null&&this.deliverySendTimeRange.length==2){
  2049. this.queryParams.deliverySendTimeRange=this.deliverySendTimeRange[0]+"--"+this.deliverySendTimeRange[1]
  2050. }
  2051. else{
  2052. this.queryParams.deliverySendTimeRange=null;
  2053. }
  2054. getOrderItemsNum(this.queryParams).then(response => {
  2055. this.orderItemNum = response.orderItemsNum;
  2056. this.loading = false;
  2057. });
  2058. },
  2059. // 取消按钮
  2060. cancel() {
  2061. this.open = false;
  2062. this.reset();
  2063. },
  2064. // 表单重置
  2065. reset() {
  2066. this.form = {
  2067. addressId:null,
  2068. userId:null,
  2069. };
  2070. this.resetForm("form");
  2071. },
  2072. /** 搜索按钮操作 */
  2073. handleQuery() {
  2074. this.queryParams.pageNum = 1;
  2075. this.getList();
  2076. this.getItemsNum();
  2077. },
  2078. /** 重置按钮操作 */
  2079. resetQuery() {
  2080. this.payTimeRange = []
  2081. this.createTimeRange = []
  2082. this.deliverySendTimeRange = []
  2083. this.deliveryImportTimeRange = []
  2084. this.resetForm("queryForm");
  2085. // 清除排序
  2086. this.currentSort = {
  2087. prop: null,
  2088. order: null
  2089. };
  2090. this.queryParams.sortField = null;
  2091. this.queryParams.sortOrder = null;
  2092. // 重置表格排序状态 - 关键代码
  2093. this.$nextTick(() => {
  2094. if (this.$refs.orderTable) {
  2095. this.$refs.orderTable.clearSort();
  2096. }
  2097. });
  2098. this.handleQuery();
  2099. },
  2100. // 多选框选中数据
  2101. handleSelectionChange(selection) {
  2102. this.ids = selection.map(item => item.id)
  2103. this.single = selection.length!==1
  2104. this.multiple = !selection.length
  2105. },
  2106. /** 新增按钮操作 */
  2107. handleAdd() {
  2108. this.reset();
  2109. this.open = true;
  2110. this.title = "创建订单";
  2111. },
  2112. /** 修改按钮操作 */
  2113. handleUpdate(row) {
  2114. this.reset();
  2115. const id = row.id || this.ids
  2116. getStoreOrder(id).then(response => {
  2117. this.form = response.data;
  2118. this.open = true;
  2119. this.title = "修改订单";
  2120. });
  2121. },
  2122. /** 提交按钮 */
  2123. submitForm() {
  2124. this.$refs["form"].validate(valid => {
  2125. this.form.products=this.products;
  2126. if (valid) {
  2127. console.log(this.form);
  2128. createUserOrder(this.form).then(response => {
  2129. if (response.code === 200) {
  2130. this.msgSuccess("创建成功");
  2131. this.open = false;
  2132. this.getList();
  2133. }
  2134. });
  2135. }
  2136. });
  2137. },
  2138. /** 删除按钮操作 */
  2139. handleDelete(row) {
  2140. this.products.splice(this.products.findIndex(item => item.id === row.id), 1)
  2141. this.compute();
  2142. },
  2143. /** 删除按钮操作 */
  2144. handleOrderDelete(row) {
  2145. const ids = row.id || this.ids;
  2146. this.$confirm('是否确认删除当前选择的订单数据项?', "警告", {
  2147. confirmButtonText: "确定",
  2148. cancelButtonText: "取消",
  2149. type: "warning"
  2150. }).then(function () {
  2151. return delStoreOrder(ids);
  2152. }).then(() => {
  2153. this.getList();
  2154. this.msgSuccess("删除成功");
  2155. }).catch(() => {
  2156. });
  2157. },
  2158. /** 导出按钮操作 */
  2159. handleOrderExport() {
  2160. // 打开字段选择对话框
  2161. this.exportFieldDialog.open = true;
  2162. this.exportFieldDialog.type = 1;
  2163. },
  2164. handleExportItemsDetails() {
  2165. if(this.queryParams.status=='00'){
  2166. this.queryParams.status=null;
  2167. }
  2168. if(this.createTimeRange!=null&&this.createTimeRange.length==2){
  2169. this.queryParams.createTimeRange=this.createTimeRange[0]+"--"+this.createTimeRange[1]
  2170. }
  2171. else{
  2172. this.queryParams.createTimeRange=null;
  2173. }
  2174. if(this.payTimeRange!=null&&this.payTimeRange.length==2){
  2175. this.queryParams.payTimeRange=this.payTimeRange[0]+"--"+this.payTimeRange[1]
  2176. }
  2177. else{
  2178. this.queryParams.payTimeRange=null;
  2179. }
  2180. if(this.deliveryImportTimeRange!=null&&this.deliveryImportTimeRange.length==2){
  2181. this.queryParams.deliveryImportTimeRange=this.deliveryImportTimeRange[0]+"--"+this.deliveryImportTimeRange[1]
  2182. }
  2183. else{
  2184. this.queryParams.deliveryImportTimeRange=null;
  2185. }
  2186. if(this.deliverySendTimeRange!=null&&this.deliverySendTimeRange.length==2){
  2187. this.queryParams.deliverySendTimeRange=this.deliverySendTimeRange[0]+"--"+this.deliverySendTimeRange[1]
  2188. }
  2189. else{
  2190. this.queryParams.deliverySendTimeRange=null;
  2191. }
  2192. const queryParams = this.addDateRange(this.queryParams, this.dateRange);
  2193. this.$confirm('是否确认导出所有订单明细数据项?', "警告", {
  2194. confirmButtonText: "确定",
  2195. cancelButtonText: "取消",
  2196. type: "warning"
  2197. }).then(function() {
  2198. return exportStoreOrderItemsDetails(queryParams);
  2199. }).then(response => {
  2200. this.download(response.msg);
  2201. }).catch(function() {});
  2202. },
  2203. /** 导出按钮操作 */
  2204. handleExportDetails() {
  2205. this.exportFieldDialog.open = true;
  2206. this.exportFieldDialog.type = 2;
  2207. },
  2208. handleExportItems() {
  2209. if(this.queryParams.status=='00'){
  2210. this.queryParams.status=null;
  2211. }
  2212. if(this.createTimeRange!=null&&this.createTimeRange.length==2){
  2213. this.queryParams.createTimeRange=this.createTimeRange[0]+"--"+this.createTimeRange[1]
  2214. }
  2215. else{
  2216. this.queryParams.createTimeRange=null;
  2217. }
  2218. if(this.payTimeRange!=null&&this.payTimeRange.length==2){
  2219. this.queryParams.payTimeRange=this.payTimeRange[0]+"--"+this.payTimeRange[1]
  2220. }
  2221. else{
  2222. this.queryParams.payTimeRange=null;
  2223. }
  2224. if(this.deliveryImportTimeRange!=null&&this.deliveryImportTimeRange.length==2){
  2225. this.queryParams.deliveryImportTimeRange=this.deliveryImportTimeRange[0]+"--"+this.deliveryImportTimeRange[1]
  2226. }
  2227. else{
  2228. this.queryParams.deliveryImportTimeRange=null;
  2229. }
  2230. if(this.deliverySendTimeRange!=null&&this.deliverySendTimeRange.length==2){
  2231. this.queryParams.deliverySendTimeRange=this.deliverySendTimeRange[0]+"--"+this.deliverySendTimeRange[1]
  2232. }
  2233. else{
  2234. this.queryParams.deliverySendTimeRange=null;
  2235. }
  2236. const queryParams = this.addDateRange(this.queryParams, this.dateRange);
  2237. this.$confirm('是否确认导出所有订单明细数据项?', "警告", {
  2238. confirmButtonText: "确定",
  2239. cancelButtonText: "取消",
  2240. type: "warning"
  2241. }).then(function() {
  2242. return exportStoreOrderItems(queryParams);
  2243. }).then(response => {
  2244. this.download(response.msg);
  2245. }).catch(function() {});
  2246. },
  2247. handleImport() {
  2248. this.upload.title = "导入银行回单";
  2249. this.upload.open = true;
  2250. },
  2251. submitFileForm() {
  2252. this.$refs.upload.submit();
  2253. },
  2254. handleDownloadTemplate() {
  2255. console.log("===== 点击了下载模板,进入 importTemplate 方法 ====="); // 新增这行
  2256. importTemplate().then((response) => {
  2257. console.log("接口返回的下载链接:", response.msg);
  2258. this.download(response.msg);
  2259. }).catch((error) => {
  2260. console.error("下载模板接口调用失败:", error); // 新增失败回调日志
  2261. });
  2262. },
  2263. // 文件上传中处理
  2264. handleFileUploadProgress(event, file, fileList) {
  2265. this.upload.isUploading = true;
  2266. },
  2267. // 文件上传成功处理
  2268. handleFileSuccess(response, file, fileList) {
  2269. this.upload.open = false;
  2270. this.upload.isUploading = false;
  2271. this.$refs.upload.clearFiles();
  2272. this.importMsgOpen=true;
  2273. this.importMsg=response.msg
  2274. // this.$alert(response.msg, '导入结果', {
  2275. // dangerouslyUseHTMLString: true
  2276. // });
  2277. this.getList();
  2278. },
  2279. /** 查询部门下拉树结构 */
  2280. getTreeselect() {
  2281. var that=this;
  2282. var param={companyId:this.companyId}
  2283. treeselect(param).then((response) => {
  2284. this.deptOptions = response.data;
  2285. console.log(this.deptOptions)
  2286. if(response.data!=null&&response.data.length>0){
  2287. //this.queryParams.deptId=response.data[0].id;
  2288. }
  2289. });
  2290. },
  2291. companyChange(val){
  2292. console.log(val);
  2293. this.companyId=val;
  2294. this.getTreeselect();
  2295. },
  2296. currDeptChange(val){
  2297. console.log(val)
  2298. this.queryParams.deptId=val;
  2299. this.getList();
  2300. },
  2301. //打开发货单
  2302. openDeliveryNote(){
  2303. this.deliveryNoteOpen=true;
  2304. // this.getAppList();
  2305. },
  2306. handleClose(done) {
  2307. this.$confirm('确认关闭?')
  2308. .then(_ => {
  2309. done();
  2310. })
  2311. .catch(_ => {});
  2312. },
  2313. //发货单模板下载
  2314. importDeliveryNoteTemplate(){
  2315. importDeliveryNoteExpressTemplate().then((response) => {
  2316. this.download(response.msg)
  2317. })
  2318. },
  2319. getAppList() {
  2320. this.miniAppList = []
  2321. const key = "courseMa.config"
  2322. getConfigByKey(key).then(response => {
  2323. const {code,data} = response
  2324. if (code === 200) {
  2325. let value = data?.configValue
  2326. if (value) {
  2327. console.log("打印-----------------》",value)
  2328. const appList = JSON.parse(value);
  2329. this.miniAppList = appList.filter(v => v.type === '1').map(v => {
  2330. return { appId: v.appid, appName: v.name }
  2331. })
  2332. }
  2333. }
  2334. })
  2335. },
  2336. // 提交发货单
  2337. submitDeliveryNote() {
  2338. const uploadFiles = this.$refs.upload.uploadFiles;
  2339. if (uploadFiles.length === 0) {
  2340. this.$message.error('请选择要上传的文件');
  2341. return;
  2342. }
  2343. this.$refs.upload.submit();
  2344. },
  2345. }
  2346. };
  2347. </script>
  2348. <style scoped lang="scss">
  2349. .items{
  2350. margin: 5px 0px;
  2351. display: flex;
  2352. flex-direction: row;
  2353. align-items: center;
  2354. justify-content: flex-start;
  2355. .pic{
  2356. width:60px;
  2357. height:60px;
  2358. }
  2359. .goods-content{
  2360. margin-left: 10px;
  2361. max-width: 200px;
  2362. text-align: left;
  2363. .goods-title{
  2364. overflow:hidden;
  2365. white-space: nowrap;
  2366. text-overflow: ellipsis;
  2367. -o-text-overflow:ellipsis;
  2368. }
  2369. }
  2370. }
  2371. .el-message-box__message p{
  2372. max-height: 400px;
  2373. overflow:scroll;
  2374. }
  2375. .import-msg{
  2376. height: 500px;
  2377. overflow: auto;
  2378. }
  2379. </style>
  2380. <style>
  2381. .el-descriptions-item__label.is-bordered-label{
  2382. font-weight: normal;
  2383. }
  2384. </style>
  2385. <style scoped>
  2386. .tag-input-order-search {
  2387. padding: 20px;
  2388. background: #fff;
  2389. border-radius: 4px;
  2390. }
  2391. .tag-input-container {
  2392. min-width: 445px;
  2393. }
  2394. .tags-wrapper {
  2395. min-height: 32px;
  2396. padding: 4px 8px;
  2397. border: 1px solid #dcdfe6;
  2398. border-radius: 4px;
  2399. cursor: text;
  2400. display: flex;
  2401. flex-wrap: wrap;
  2402. align-items: center;
  2403. gap: 4px;
  2404. transition: border-color 0.2s;
  2405. }
  2406. .tags-wrapper:hover {
  2407. border-color: #c0c4cc;
  2408. }
  2409. .tags-wrapper:focus-within {
  2410. border-color: #409eff;
  2411. box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.2);
  2412. }
  2413. .order-tag {
  2414. margin: 2px;
  2415. flex-shrink: 0;
  2416. }
  2417. .tag-error {
  2418. background-color: #fef0f0;
  2419. border-color: #fbc4c4;
  2420. color: #f56c6c;
  2421. }
  2422. .tag-input {
  2423. border: none;
  2424. outline: none;
  2425. flex: 1;
  2426. min-width: 120px;
  2427. }
  2428. .tag-input >>> .el-input__inner {
  2429. border: none;
  2430. padding: 0;
  2431. height: 24px;
  2432. line-height: 24px;
  2433. }
  2434. .button-new-tag {
  2435. height: 24px;
  2436. line-height: 22px;
  2437. padding: 0 8px;
  2438. margin: 2px;
  2439. }
  2440. .input-tips {
  2441. margin-top: 4px;
  2442. font-size: 12px;
  2443. color: #909399;
  2444. }
  2445. /* 新增排序相关样式 */
  2446. .sort-info {
  2447. margin-top: 10px;
  2448. padding: 8px 0;
  2449. }
  2450. /* 表格布局优化 */
  2451. .el-table {
  2452. min-width: 100%;
  2453. table-layout: fixed;
  2454. }
  2455. .el-table .el-table__body-wrapper {
  2456. overflow-x: auto;
  2457. }
  2458. .tip-text {
  2459. display: flex;
  2460. align-items: center;
  2461. gap: 8px;
  2462. }
  2463. .quick-actions {
  2464. margin-top: 12px;
  2465. display: flex;
  2466. justify-content: space-between;
  2467. align-items: center;
  2468. padding: 8px 0;
  2469. border-top: 1px solid #ebeef5;
  2470. }
  2471. .stats-info {
  2472. font-size: 12px;
  2473. color: #909399;
  2474. display: flex;
  2475. align-items: center;
  2476. gap: 4px;
  2477. }
  2478. .invalid-codes-list {
  2479. margin: 16px 0;
  2480. max-height: 200px;
  2481. overflow-y: auto;
  2482. }
  2483. .invalid-tag {
  2484. margin: 4px;
  2485. }
  2486. .debug-preview {
  2487. margin-top: 20px;
  2488. }
  2489. .debug-content {
  2490. font-size: 12px;
  2491. }
  2492. .debug-content code {
  2493. display: block;
  2494. background: #f5f5f5;
  2495. padding: 8px;
  2496. border-radius: 4px;
  2497. margin: 4px 0 12px 0;
  2498. white-space: pre-wrap;
  2499. }
  2500. /* 响应式设计 */
  2501. @media (max-width: 768px) {
  2502. .tag-input-container {
  2503. min-width: auto;
  2504. width: 100%;
  2505. }
  2506. .tags-wrapper {
  2507. min-height: 40px;
  2508. }
  2509. .quick-actions {
  2510. flex-direction: column;
  2511. align-items: flex-start;
  2512. gap: 8px;
  2513. }
  2514. }
  2515. </style>