index.vue 87 KB

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