index.vue 89 KB

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