index.vue 95 KB

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