order1.vue 77 KB

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