order1.vue 76 KB

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