index.vue 93 KB

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