| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648 |
- <template>
- <div class="app-container">
- <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
- <!-- <el-form-item label="公司名" prop="companyId">-->
- <!-- <el-select filterable v-model="queryParams.companyId" placeholder="请选择公司名" @change="companyChange" clearable size="small">-->
- <!-- <el-option-->
- <!-- v-for="item in companys"-->
- <!-- :key="item.companyId"-->
- <!-- :label="item.companyName"-->
- <!-- :value="item.companyId"-->
- <!-- />-->
- <!-- </el-select>-->
- <!-- </el-form-item>-->
- <!-- <el-form-item>-->
- <!-- <treeselect style="width: 220px" :clearable="false" v-model="queryParams.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门" />-->
- <!-- </el-form-item>-->
- <!-- <el-form-item label="订单号" prop="orderCode">
- <el-input
- v-model="queryParams.orderCode"
- placeholder="请输入订单号"
- clearable
- size="small"
- @keyup.enter.native="handleQuery"
- />
- </el-form-item> -->
- <el-form-item label="订单号" prop="orderCodes">
- <div class="tag-input-container">
- <!-- 标签显示区域 -->
- <div class="tags-wrapper" @click="focusInput">
- <!-- 已添加的订单号标签 -->
- <el-tag
- v-for="(code, index) in queryParams.orderCodes"
- :key="index"
- closable
- size="small"
- @close="removeOrderCode(index)"
- class="order-tag"
- :class="{ 'tag-error': false }"
- >
- {{ code }}
- </el-tag>
- <!-- 输入框 -->
- <el-input
- ref="tagInput"
- v-model="currentInput"
- v-show="inputVisible || queryParams.orderCodes.length === 0"
- :placeholder="queryParams.orderCodes.length === 0 ? '请输入订单号,按回车或逗号分隔' : '继续输入...'"
- size="small"
- class="tag-input"
- @keydown.native="handleKeyDown"
- @keyup.native="handleKeyUp"
- @blur="handleInputConfirm"
- @focus="inputVisible = true"
- clearable
- />
- <!-- 添加按钮(当没有输入时显示) -->
- <el-button
- v-if="!inputVisible && queryParams.orderCodes.length > 0"
- class="button-new-tag"
- size="small"
- @click="showInput"
- icon="el-icon-plus"
- type="text"
- >
- 添加订单号
- </el-button>
- </div>
- <!-- 输入提示 -->
- <div class="input-tips">
- <span class="tip-text">
- 支持:回车、逗号、空格分隔 |
- 已添加 {{ queryParams.orderCodes.length }} 个订单号
- <span v-if="maxOrderCodes > 0"> (最多{{ maxOrderCodes }}个)</span>
- </span>
- </div>
- </div>
- </el-form-item>
- <el-form-item label="运单号" prop="deliveryId">
- <el-input
- v-model="queryParams.deliveryId"
- placeholder="请输入运单号"
- clearable
- size="small"
- @keyup.enter.native="handleQuery"
- />
- </el-form-item>
- <el-form-item label="产品名称" prop="productName">
- <el-input
- v-model="queryParams.productName"
- placeholder="请输入产品名称"
- clearable
- size="small"
- @keyup.enter.native="handleQuery"
- />
- </el-form-item>
- <el-form-item label="手机号" prop="userPhone">
- <el-input
- v-model="queryParams.userPhone"
- placeholder="请输入手机号"
- clearable
- size="small"
- @keyup.enter.native="handleQuery"
- />
- </el-form-item>
- <el-form-item label="收件人" prop="realName">
- <el-input
- v-model="queryParams.realName"
- placeholder="请输入收件人姓名"
- clearable
- size="small"
- @keyup.enter.native="handleQuery"/>
- </el-form-item>
- <el-form-item label="员工姓名" prop="companyUserNickName">
- <el-input
- v-model="queryParams.companyUserNickName"
- placeholder="请输入员工姓名"
- clearable
- size="small"
- @keyup.enter.native="handleQuery"
- />
- </el-form-item>
- <el-form-item label="订单类型" prop="orderType">
- <el-select v-model="queryParams.orderType" placeholder="请选择订单类型" clearable size="small" >
- <el-option
- v-for="item in orderTypeOptions"
- :key="item.dictValue"
- :label="item.dictLabel"
- :value="item.dictValue"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="支付方式" prop="payType">
- <el-select v-model="queryParams.payType" placeholder="请选择支付方式" clearable size="small" >
- <el-option
- v-for="item in payTypeOptions"
- :key="item.dictValue"
- :label="item.dictLabel"
- :value="item.dictValue"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="上传凭证" prop="isUpload">
- <el-select v-model="queryParams.isUpload" placeholder="请选择" clearable size="small" >
- <el-option key="0" label="未上传" value="0" />
- <el-option key="1" label="已上传" value="1" />
- </el-select>
- </el-form-item>
- <el-form-item label="物流状态" prop="deliveryStatus">
- <el-select v-model="queryParams.deliveryStatus" placeholder="请选择物流状态" clearable size="small" >
- <el-option
- v-for="item in deliveryStatusOptions"
- :key="item.dictValue"
- :label="item.dictLabel"
- :value="item.dictValue"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="结算状态" prop="deliveryPayStatus">
- <el-select v-model="queryParams.deliveryPayStatus" placeholder="请选择物流结算状态" clearable size="small" >
- <el-option
- v-for="item in deliveryPayStatusOptions"
- :key="item.dictValue"
- :label="item.dictLabel"
- :value="item.dictValue"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="小程序" prop="appId">
- <el-select v-model="queryParams.appId" placeholder="请选择所属小程序" clearable size="small">
- <el-option
- v-for="dict in appMallOptions"
- :key="dict.appid"
- :label="dict.name + '(' + dict.appid + ')'"
- :value="dict.appid"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="下单时间" prop="createTimeRange">
- <el-date-picker
- style="width:215px"
- clearable size="small"
- v-model="createTimeRange"
- type="daterange"
- value-format="yyyy-MM-dd"
- start-placeholder="开始日期"
- end-placeholder="结束日期">
- </el-date-picker>
- </el-form-item>
- <el-form-item label="支付时间" prop="payTimeRange">
- <el-date-picker
- style="width: 215px"
- clearable size="small"
- v-model="payTimeRange"
- type="daterange"
- value-format="yyyy-MM-dd"
- start-placeholder="开始日期"
- end-placeholder="结束日期">
- </el-date-picker>
- </el-form-item>
- <el-form-item label="发货时间" prop="deliverySendTimeRange">
- <el-date-picker
- style="width:215px"
- clearable size="small"
- v-model="deliverySendTimeRange"
- type="daterange"
- value-format="yyyy-MM-dd"
- start-placeholder="开始日期"
- end-placeholder="结束日期">
- </el-date-picker>
- </el-form-item>
- <el-form-item label="回单时间" prop="deliveryImportTimeRange">
- <el-date-picker
- style="width:215px"
- clearable size="small"
- v-model="deliveryImportTimeRange"
- type="daterange"
- value-format="yyyy-MM-dd"
- start-placeholder="开始日期"
- end-placeholder="结束日期">
- </el-date-picker>
- </el-form-item>
- <!-- <el-form-item label="档期归属" prop="scheduleId" >-->
- <!-- <el-select filterable style="width: 215px" v-model="queryParams.scheduleId" placeholder="请选择档期" clearable size="small" >-->
- <!-- <el-option-->
- <!-- v-for="item in scheduleOptions"-->
- <!-- :key="item.id"-->
- <!-- :label="item.name"-->
- <!-- :value="item.id"-->
- <!-- />-->
- <!-- </el-select>-->
- <!-- </el-form-item>-->
- <el-form-item label="代服账户" prop="erpAccount" v-if="SFDFopen">
- <el-select v-model="queryParams.erpAccount" style="width: 215px" placeholder="ERP账户" clearable size="small">
- <el-option
- v-for="dict in erpAccountQueryList"
- :key="dict"
- :label="dict"
- :value="dict"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="代服电话" prop="erpPhoneNumber" v-if="SFDFopen">
- <el-input
- v-model="queryParams.erpPhoneNumber"
- placeholder="ERP电话"
- clearable
- size="small"
- @keyup.enter.native="handleQuery"
- />
- </el-form-item>
- <el-form-item>
- <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
- </el-form-item>
- </el-form>
- <el-row :gutter="10" class="mb8">
- <!-- <el-col :span="1.5">
- <el-button
- type="primary"
- icon="el-icon-plus"
- size="mini"
- @click="handleAdd"
- v-hasPermi="['store:storeOrder:add']"
- >创建订单</el-button>
- </el-col> -->
- <el-col :span="1.5">
- <el-button plain type="info" icon="el-icon-upload2" size="mini" @click="handleImport" v-hasPermi="['store:storeOrder:importExpress']">导入银行回单</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button
- type="warning"
- icon="el-icon-download"
- size="mini"
- @click="handleOrderExport"
- v-hasPermi="['store:storeOrder:export']"
- >导出订单</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button
- type="warning"
- icon="el-icon-download"
- size="mini"
- @click="handleExportItems"
- v-hasPermi="['store:storeOrder:exportItems']"
- >导出订单明细</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button
- type="warning"
- icon="el-icon-s-order"
- size="mini"
- @click="openDeliveryNote"
- >批量导入物流单号</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button
- type="warning"
- icon="el-icon-download"
- size="mini"
- @click="handleExportDetails"
- v-hasPermi="['store:storeOrder:export:details']"
- >导出订单(明文)</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button
- type="warning"
- icon="el-icon-download"
- size="mini"
- @click="handleExportItemsDetails"
- v-hasPermi="['store:storeOrder:exportItems:details']"
- >导出订单明细(明文)</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button
- type="danger"
- plain
- icon="el-icon-delete"
- size="mini"
- :disabled="multiple"
- @click="handleOrderDelete"
- v-hasPermi="['store:storeOrder:remove']"
- >删除
- </el-button>
- </el-col>
- <el-col :span="1.5" v-if="SFDFopen && orderStatus == 6"> <!--待推送erp-->
- <el-tooltip content="默认erp推送手机号" placement="top">
- <el-button
- type="warning"
- plain
- icon="el-icon-phone"
- size="mini"
- @click="handleErpPhone"
- v-hasPermi="['store:storeOrder:erpphone']"
- >推送手机号码</el-button>
- </el-tooltip>
- </el-col>
- <el-col :span="1.5" v-if="SFDFopen && orderStatus == 6">
- <el-tooltip content="批量设置erp推送手机号" placement="top">
- <el-button
- type="warning"
- plain
- icon="el-icon-phone"
- size="mini"
- @click="setErpPhone"
- v-hasPermi="['his:storeOrder:createErpOrder']"
- >设置推送手机</el-button>
- </el-tooltip>
- </el-col>
- <el-col :span="1.5" v-if="SFDFopen && orderStatus == 6">
- <el-tooltip content="批量设置erp账户" placement="top">
- <el-button
- type="warning"
- plain
- icon="el-icon-s-cooperation"
- size="mini"
- @click="showErpAccountSetDialog"
- v-hasPermi="['his:storeOrder:createErpOrder']"
- >数据分捡</el-button>
- </el-tooltip>
- </el-col>
- <el-col :span="1.5" v-if="SFDFopen && orderStatus == 6">
- <el-tooltip content="批量推送erp" placement="top">
- <el-button
- type="warning"
- plain
- icon="el-icon-s-cooperation"
- size="mini"
- @click="showErpAccountDialog"
- v-hasPermi="['his:storeOrder:createErpOrder']"
- >创建erp</el-button>
- </el-tooltip>
- </el-col>
- <el-col :span="1.5">
- <el-button
- disabled
- plain
- type="primary"
- size="mini"
- >应付金额: {{ payPriceTotal}}</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button
- disabled
- plain
- type="primary"
- size="mini"
- >实付金额: {{payMoneyTotal}}</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button
- disabled
- plain
- type="primary"
- size="mini"
- >物流代收金额: {{payRemainTotal }}</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button
- disabled
- plain
- type="primary"
- size="mini"
- >订单量/金额: {{ total }}/{{payPriceTotal }}</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-input
- v-model="orderItemNum"
- disabled
- size="mini"
- />
- </el-col>
- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
- </el-row>
- <el-tabs type="card" v-model="activeName" @tab-click="handleClick">
- <el-tab-pane label="全部订单" name="00"></el-tab-pane>
- <el-tab-pane label="待支付" name="0"></el-tab-pane>
- <el-tab-pane label="待推送" name="6"></el-tab-pane>
- <el-tab-pane label="待发货" name="1"></el-tab-pane>
- <el-tab-pane label="待收货" name="2"></el-tab-pane>
- <el-tab-pane label="交易完成" name="3"></el-tab-pane>
- <el-tab-pane label="退款中" name="-1"></el-tab-pane>
- <el-tab-pane label="已退款" name="-2"></el-tab-pane>
- <el-tab-pane label="已取消" name="-3"></el-tab-pane>
- </el-tabs>
- <el-table ref="orderTable" height="500" border v-loading="loading" :data="storeOrderList" @selection-change="handleSelectionChange"
- @sort-change="handleSortChange" :default-sort="{prop: 'createTime', order: 'descending'}">
- <el-table-column type="selection" width="55" align="center" />
- <el-table-column label="订单号" align="center" prop="orderCode" width="200px" />
- <el-table-column label="ERP电话" align="center" prop="erpPhone" width="120px" v-if="SFDFopen "/>
- <el-table-column label="ERP账号" align="center" prop="erpAccount" width="120px" v-if="SFDFopen"/>
- <el-table-column label="所属公司" align="center" prop="companyName" />
- <el-table-column label="所属员工" align="center" prop="companyUserNickName" width="120px" sortable="custom" :sort-orders="['ascending', 'descending']">
- <template slot="header" slot-scope="scope">
- <span>所属员工</span>
- <el-tooltip content="按所属员工排序" placement="top"/>
- </template>
- </el-table-column>
- <el-table-column label="小程序名称" width="120px" align="center" prop="miniProgramName"/>
- <el-table-column label="用户昵称" align="center" prop="nickname" width="150px" >
- <template slot-scope="scope">
- <span>{{scope.row.nickname}} </span>
- </template>
- </el-table-column>
- <el-table-column label="收件人" align="center" prop="realName" width="150px" >
- <template slot-scope="scope">
- <span>{{scope.row.realName}} </span>
- </template>
- </el-table-column>
- <!-- <el-table-column label="商品" align="center" width="300px" >
- <template slot-scope="scope">
- <div v-for="(item, index) in scope.row.items" class="items" >
- <img class="pic" :src="JSON.parse(item.jsonInfo).image" />
- <div class="goods-content">
- <div class="goods-title">{{ JSON.parse(item.jsonInfo).productName}}</div>
- <div class="sku">{{ JSON.parse(item.jsonInfo).sku}}</div>
- <div class="price">¥{{JSON.parse(item.jsonInfo).price}}×{{item.num}}</div>
- </div>
- </div>
- </template>
- </el-table-column> -->
- <el-table-column label="订单金额" align="center" prop="totalPrice" >
- <template slot-scope="scope">
- <span v-if="scope.row.totalPrice!=null">{{scope.row.totalPrice.toFixed(2)}}</span>
- </template>
- </el-table-column>
- <!-- <el-table-column label="应付金额" align="center" prop="payPrice" >
- <template slot-scope="scope">
- <span v-if="scope.row.payPrice!=null">{{scope.row.payPrice.toFixed(2)}}</span>
- </template>
- </el-table-column> -->
- <el-table-column label="应付金额" align="center" prop="payPrice" width="100px" sortable="custom" :sort-orders="['ascending', 'descending']">
- <template slot="header" slot-scope="scope">
- <span >应收金额</span>
- <el-tooltip content="按应收金额排序" placement="top"/>
- </template>
- </el-table-column>
- <el-table-column label="实付金额" align="center" prop="payMoney" >
- <template slot="header" slot-scope="scope">
- <span>实收金额</span>
- <el-tooltip content="按实收金额排序" placement="top"/>
- </template>
- </el-table-column>
- <el-table-column label="物流代收金额" align="center" prop="payDelivery" >
- <template slot-scope="scope">
- <span v-if="scope.row.payPrice!=null">{{scope.row.payDelivery.toFixed(2)}}</span>
- </template>
- </el-table-column>
- <el-table-column label="下单时间" align="center" prop="createTime" />
- <!-- <el-table-column label="支付状态" align="center" prop="paid" /> -->
- <el-table-column label="支付时间" align="center" prop="payTime" width="180" />
- <el-table-column label="发货时间" align="center" prop="deliverySendTime" width="180"></el-table-column>
- <el-table-column label="支付方式" align="center" prop="payType" >
- <template slot-scope="scope">
- <el-tag prop="payType" v-for="(item, index) in payTypeOptions" v-if="scope.row.payType==item.dictValue">{{item.dictLabel}}</el-tag>
- </template>
- </el-table-column>
- <el-table-column label="订单类型" align="center" prop="orderType" >
- <template slot-scope="scope">
- <el-tag prop="orderType" v-for="(item, index) in orderTypeOptions" v-if="scope.row.orderType==item.dictValue">{{item.dictLabel}}</el-tag>
- </template>
- </el-table-column>
- <el-table-column label="媒体来源" align="center" prop="orderMedium" >
- <template slot-scope="scope">
- <el-tag prop="orderMedium" v-for="(item, index) in orderMediumOptions" v-if="scope.row.orderMedium==item.dictValue">{{item.dictLabel}}</el-tag>
- </template>
- </el-table-column>
- <el-table-column label="产品名称" align="center" width="200px">
- <template slot-scope="scope">
- <div v-if="scope.row.items && scope.row.items.length > 0">
- <el-tag
- v-for="(item, index) in scope.row.items"
- :key="index"
- size="mini"
- class="product-tag"
- >
- {{ JSON.parse(item.jsonInfo).productName }} × {{ item.num }}
- </el-tag>
- </div>
- <span v-else class="no-products">暂无商品</span>
- </template>
- </el-table-column>
- <el-table-column label="状态" align="center" prop="status" >
- <template slot-scope="scope">
- <el-tag prop="status" v-for="(item, index) in statusOptions" v-if="scope.row.status==item.dictValue">{{item.dictLabel}}</el-tag>
- </template>
- </el-table-column>
- <el-table-column label="运单号" align="center" prop="deliveryId" >
- </el-table-column>
- <el-table-column label="物流状态" align="center" prop="deliveryStatus" >
- <template slot-scope="scope">
- <el-tag prop="status" v-for="(item, index) in deliveryStatusOptions" v-if="scope.row.deliveryStatus==item.dictValue">{{item.dictLabel}}</el-tag>
- </template>
- </el-table-column>
- <el-table-column label="物流结算状态" align="center" prop="deliveryPayStatus" >
- <template slot-scope="scope">
- <el-tag prop="status" v-for="(item, index) in deliveryPayStatusOptions" v-if="scope.row.deliveryPayStatus==item.dictValue">{{item.dictLabel}}</el-tag>
- </template>
- </el-table-column>
- <el-table-column label="操作" fixed="right" width="80px" align="center" class-name="small-padding fixed-width">
- <template slot-scope="scope">
- <el-button
- size="mini"
- type="text"
- @click="handleDetails(scope.row)"
- v-hasPermi="['store:storeOrder:query']"
- >查看</el-button>
- <!-- <el-button
- size="mini"
- type="text"
- @click="handleGenPayUrl(scope.row)"
- v-hasPermi="['store:storeOrder:genPayUrl']"
- >生成付款链接</el-button> -->
- </template>
- </el-table-column>
- </el-table>
- <div>
- 商品数量合计:{{ productInfo }}
- </div>
- <!-- 排序状态显示 -->
- <div v-if="currentSort.prop" class="sort-info">
- <el-tag size="small" type="info" closable @close="clearSort">
- <i class="el-icon-sort"></i>
- 当前排序:{{ getSortLabel(currentSort.prop) }}
- {{ currentSort.order === 'ascending' ? '升序' : '降序' }}
- </el-tag>
- <el-button
- type="text"
- size="mini"
- @click="clearSort"
- style="margin-left: 8px; color: #909399;"
- >
- </el-button>
- </div>
- <pagination
- v-show="total>0"
- :total="total"
- :page.sync="queryParams.pageNum"
- :limit.sync="queryParams.pageSize"
- @pagination="getList"
- />
- <el-drawer size="75%" :title="show.title" :visible.sync="show.open">
- <product-order ref="order" />
- </el-drawer>
- <el-dialog :title="title" v-if="open" :visible.sync="open" width="1000px" append-to-body>
- <el-form ref="form" :model="form" :rules="rules" label-width="120px">
- <el-form-item label="会员信息" prop="userId">
- <el-row >
- <el-col >
- <el-input placeholder="请输入会员手机号" style="width:240px;cursor:pointer" v-model="phone">
- </el-input>
- <el-button plain style="margin-left:10px;" @click="searchUser()">查询</el-button>
- <el-button plain style="margin-left:10px;" icon="el-icon-plus" type="primary" @click="handleAddUser()">添加会员</el-button>
- </el-col>
- </el-row>
- <el-table border style="margin-top:5px;" v-loading="userloading" :data="users">
- <el-table-column label="ID" align="center" prop="userId" />
- <el-table-column label="会员头像" align="center" width="80">
- <template slot-scope="scope">
- <el-popover
- placement="right"
- title=""
- trigger="hover"
- >
- <img slot="reference" :src="scope.row.avatar" width="50" >
- <img :src="scope.row.avatar" style="max-width: 120px;">
- </el-popover>
- </template>
- </el-table-column>
- <el-table-column label="昵称" align="center" prop="nickname" />
- <el-table-column label="手机号" align="center" prop="phone" />
- <el-table-column label="状态" align="center" prop="status" >
- <template slot-scope="scope">
- <el-tag prop="status" v-for="(item, index) in userStatusOptions" v-if="scope.row.status==item.dictValue">{{item.dictLabel}}</el-tag>
- </template>
- </el-table-column>
- </el-table>
- </el-form-item>
- <el-form-item label="收货信息" prop="addressId">
- <el-row >
- <el-col >
- <el-button plain type="primary" icon="el-icon-plus" @click="handleAddUserAddress()">添加收货地址</el-button>
- </el-col>
- </el-row>
- <el-radio-group v-model="form.addressId" style="width:100%">
- <el-table border style="margin-top:5px;" v-loading="addressloading" :data="address">
- <el-table-column label="ID" align="center" >
- <template slot-scope="scope">
- <el-radio :label="scope.row.id"></el-radio>
- </template>
- </el-table-column>
- <el-table-column label="收货人姓名" align="center" prop="realName" />
- <el-table-column label="收货人电话" align="center" prop="phone" />
- <el-table-column label="地址" align="center" prop="detail" >
- <template slot-scope="scope">
- {{scope.row.province}} {{scope.row.city}} {{scope.row.district}} {{scope.row.detail}}
- </template>
- </el-table-column>
- </el-table>
- </el-radio-group>
- </el-form-item>
- <el-form-item label="商品列表" >
- <el-row >
- <el-col >
- <el-button plain type="primary" icon="el-icon-plus" @click="handleAddProduct">添加商品</el-button>
- </el-col>
- </el-row>
- <el-table border :key = "tablekey" width="100%" style="margin-top:5px;" :data="products">
- <el-table-column label="商品编号" align="center" prop="barCode" />
- <el-table-column label="商品图片" align="center" width="100">
- <template slot-scope="scope">
- <el-popover
- placement="right"
- title=""
- trigger="hover"
- >
- <img slot="reference" :src="scope.row.image" width="50">
- <img :src="scope.row.image" style="max-width: 50px;">
- </el-popover>
- </template>
- </el-table-column>
- <el-table-column label="产品名称" show-overflow-tooltip align="center" prop="productName" />
- <el-table-column label="商品规格" align="center" prop="sku" />
- <el-table-column label="库存" align="center" prop="stock" />
- <el-table-column label="单价" align="center" prop="price" />
- <el-table-column label="数量" align="center" prop="count" width="200px" :key="tablekey">
- <template slot-scope="scope">
- <div>
- <el-input-number v-model="scope.row.count" @change="handleProductCountChange(scope.row)" size="mini" :min="1" :max="scope.row.stock" ></el-input-number>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="小计" align="center" prop="money" />
- <el-table-column label="操作" align="center" width="100px" >
- <template slot-scope="scope">
- <el-button
- size="mini"
- type="text"
- icon="el-icon-delete"
- @click="handleDelete(scope.row)"
- >删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <el-row>
- <el-col>
- <span>商品合计:{{products.length}}</span><span style="margin-left:10px;">商品总价:{{totalMoney.toFixed(2)}}</span>
- </el-col>
- </el-row>
- </el-form-item>
- <el-form-item label="订单备注" prop="mark">
- <el-input type="textarea" rows="2" v-model="form.mark" placeholder="" />
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="submitForm">确 定</el-button>
- <el-button @click="cancel">取 消</el-button>
- </div>
- </el-dialog>
- <el-dialog :title="product.title" v-if="product.open" :visible.sync="product.open" width="1000px" append-to-body>
- <product-select @selectProduct="selectProduct" />
- </el-dialog>
- <el-dialog :title="user.title" v-if="user.open" :visible.sync="user.open" width="500px" append-to-body>
- <add-user @addUser="addUser" />
- </el-dialog>
- <el-dialog :title="userAddress.title" v-if="userAddress.open" :visible.sync="userAddress.open" width="800px" append-to-body>
- <add-user-address ref="addUserAddress" @addUserAddress="addUserAddress" />
- </el-dialog>
- <el-dialog :title="payQr.title" v-if="payQr.open" :visible.sync="payQr.open" width="240px" append-to-body>
- <div style="padding-bottom:15px;" >
- <div class="qrcode" ref="qrCodeUrl"></div>
- </div>
- </el-dialog>
- <el-dialog :title="upload.title" :visible.sync="upload.open" append-to-body width="400px">
- <el-upload ref="upload" :action="upload.url + '?updateSupport=' + upload.updateSupport" :auto-upload="false" :disabled="upload.isUploading"
- :headers="upload.headers" :limit="1"
- :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" accept=".xlsx, .xls" drag
- >
- <i class="el-icon-upload"></i>
- <div class="el-upload__text">
- 将文件拖到此处,或
- <em>点击上传</em>
- </div>
- <div slot="tip" class="el-upload__tip">
- <!-- <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的数据 -->
- <el-link
- style="font-size:12px"
- type="info"
- id="templateDownloadLink"
- >
- 下载模板
- </el-link>
- </div>
- <div slot="tip" class="el-upload__tip" style="color:red">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
- </el-upload>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="submitFileForm">确 定</el-button>
- <el-button @click="upload.open = false">取 消</el-button>
- </div>
- </el-dialog>
- <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="importMsgOpen"
- append-to-body title="导入结果" width="500px"
- >
- <h1>{{importMsg}}</h1>
- </el-dialog>
- <!-- 批量发货 -->
- <el-dialog
- :before-close="handleClose"
- :visible.sync="deliveryNoteOpen"
- center
- title="批量发货"
- width="35%"
- >
- <span slot="footer" class="dialog-footer">
- <!-- 小程序Appid选择 -->
- <!-- <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">-->
- <!-- <el-form-item label="小程序:" prop="miniAppId">-->
- <!-- <el-select-->
- <!-- v-model="ruleForm.miniAppId"-->
- <!-- clearable-->
- <!-- placeholder="请选择发货小程序"-->
- <!-- style="width: 100%"-->
- <!-- >-->
- <!-- <el-option-->
- <!-- v-for="item in miniAppList"-->
- <!-- :key="item.appId"-->
- <!-- :label="item.appName"-->
- <!-- :value="item.appId"-->
- <!-- />-->
- <!-- </el-select>-->
- <!-- </el-form-item>-->
- <!-- </el-form>-->
- <el-upload ref="upload" :action="orderUpload.url" :auto-upload="false" :disabled="orderUpload.isUploading" :headers="orderUpload.headers"
- :limit="1" :on-progress="handleFileUploadProgress"
- :on-success="handleFileSuccess" accept=".xlsx, .xls" drag
- >
- <i class="el-icon-upload"></i>
- <div class="el-upload__text">
- 将文件拖到此处,或
- <em>点击上传</em>
- </div>
- <div slot="tip" class="el-upload__tip">
- <el-link
- type="info"
- id="templateDownloadLink"
- @click.prevent="importDeliveryNoteTemplate"
- >
- 下载模板
- </el-link>
- </div>
- <div slot="tip" class="el-upload__tip" style="color:red">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
- </el-upload>
- <el-divider></el-divider>
- <el-button @click="deliveryNoteOpen = false">取 消</el-button>
- <el-button type="primary" @click="submitDeliveryNote">确 定</el-button>
- </span>
- </el-dialog>
- <!-- 设置推送手机对话框 -->
- <el-dialog :title="erpPhone.title" :visible.sync="erpPhone.open" width="600px" append-to-body>
- <div style="margin-bottom: 20px;">
- <el-button type="primary" size="small" @click="handleAddPhone">新增手机号</el-button>
- </div>
- <el-table :data="phoneList" border style="width: 100%">
- <el-table-column prop="phone" label="手机号" align="center">
- <template slot-scope="scope">
- <el-input
- v-if="scope.row.editing"
- v-model="scope.row.phone"
- placeholder="请输入手机号"
- @blur="validatePhone(scope.row)"
- @keyup.enter.native="handleSavePhone(scope.$index)"
- />
- <span v-else>{{ scope.row.phone }}</span>
- </template>
- </el-table-column>
- <el-table-column label="操作" align="center" width="300">
- <template slot-scope="scope">
- <el-button
- v-if="scope.row.editing"
- type="success"
- size="mini"
- @click="handleSavePhone(scope.$index)"
- >保存</el-button>
- <el-button
- v-if="scope.row.editing"
- type="info"
- size="mini"
- @click="handleCancelEdit(scope.$index)"
- >取消</el-button>
- <el-button
- v-if="!scope.row.editing"
- type="primary"
- size="mini"
- @click="handleEditPhone(scope.$index)"
- >修改</el-button>
- <el-button
- type="danger"
- size="mini"
- @click="handleDeletePhone(scope.$index)"
- >删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="handleSavePhoneList">确 定</el-button>
- <el-button @click="handleCancelPhoneDialog">取 消</el-button>
- </div>
- </el-dialog>
- <el-dialog :title="erpPhone.title" :visible.sync="setPhoneOpen" width="600px" append-to-body>
- <el-select v-model="erpPhoneValue" multiple placeholder="请选择">
- <el-option
- v-for="item in phoneList"
- :key="item.phone"
- :label="item.phone"
- :value="item.phone">
- </el-option>
- </el-select>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="submitErpPhone">确 定</el-button>
- <el-button @click="handleCancelErpPhone">取 消</el-button>
- </div>
- </el-dialog>
- <!-- ERP账户选择对话框 -->
- <el-dialog :title="erpAccountDialog.title" :visible.sync="erpAccountDialog.open" width="600px" append-to-body>
- <div v-loading="erpAccountDialog.loading">
- <el-form :model="erpAccountForm" label-width="100px">
- <el-form-item label="ERP账户" required>
- <el-select
- v-model="erpAccountForm.selectedAccount"
- placeholder="请选择ERP账户"
- style="width: 100%"
- filterable
- >
- <el-option
- v-for="account in erpAccountList"
- :key="account"
- :label="account"
- :value="account"
- >
- <span style="float: left">{{ account}}</span>
- <span style="float: right; color: #8492a6; font-size: 13px">{{ account.accountCode }}</span>
- </el-option>
- </el-select>
- </el-form-item>
- </el-form>
- <!-- 订单统计信息 -->
- <div class="order-summary" v-if="orderSummary">
- <el-divider content-position="left">订单统计</el-divider>
- <el-row :gutter="20">
- <el-col :span="8">
- <div class="summary-item">
- <span class="label">选中订单数:</span>
- <span class="value">{{ orderSummary.selectedCount }}</span>
- </div>
- </el-col>
- <el-col :span="8">
- <div class="summary-item">
- <span class="label">总金额:</span>
- <span class="value">¥{{ orderSummary.totalAmount }}</span>
- </div>
- </el-col>
- <el-col :span="8">
- <div class="summary-item">
- <span class="label">查询条件订单:</span>
- <span class="value">{{ orderSummary.queryCount }}</span>
- </div>
- </el-col>
- </el-row>
- </div>
- </div>
- <div slot="footer" class="dialog-footer">
- <el-button @click="cancelErpAccountDialog">取 消</el-button>
- <el-button
- type="primary"
- @click="confirmCreateErpOrder"
- :disabled="!erpAccountForm.selectedAccount"
- :loading="erpAccountDialog.submitting"
- >确认</el-button>
- </div>
- </el-dialog>
- <!-- 导出字段选择对话框 -->
- <el-dialog :title="exportFieldDialog.title" :visible.sync="exportFieldDialog.open" width="800px" append-to-body>
- <div v-loading="exportFieldDialog.loading">
- <div style="margin-bottom: 20px;">
- <el-button type="primary" size="small" @click="selectAllFields">全选</el-button>
- <el-button type="default" size="small" @click="unselectAllFields">全不选</el-button>
- <el-button type="success" size="small" @click="selectDefaultFields">选择常用</el-button>
- </div>
- <div class="field-selection-container">
- <el-row :gutter="20">
- <el-col :span="8" v-for="field in exportFieldOptions" :key="field.key">
- <el-checkbox
- v-model="field.checked"
- :label="field.label"
- style="margin-bottom: 12px; width: 100%;"
- >
- {{ field.label }}
- </el-checkbox>
- </el-col>
- </el-row>
- </div>
- <div class="field-count-info" style="margin-top: 20px; padding: 10px; background: #f5f7fa; border-radius: 4px;">
- <i class="el-icon-info"></i>
- <span v-if="getSelectedFieldsCount() > 0">
- 已选择 <span style="color: #409EFF; font-weight: bold;">{{ getSelectedFieldsCount() }}</span> 个字段
- </span>
- <span v-else style="color: #E6A23C; font-weight: bold;">
- <i class="el-icon-warning"></i>
- 未选择任何字段,将导出所有字段
- </span>
- </div>
- </div>
- <div slot="footer" class="dialog-footer">
- <el-button @click="cancelExportFieldDialog">取 消</el-button>
- <el-button
- type="primary"
- @click="confirmExportFields"
- >确认导出</el-button>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import {
- importTemplate,
- exportStoreOrderItems,
- createUserOrder,
- listStoreOrder,
- getStoreOrder,
- delStoreOrder,
- addStoreOrder,
- updateStoreOrder,
- exportStoreOrder,
- getOrderItemsNum,
- importDeliveryNoteExpressTemplate, exportStoreOrderDetails, exportStoreOrderItemsDetails,getErpAccount,
- queryErpPhone,
- saveErpPhone,editErpPhone,batchCreateErpOrder,batchSetErpOrder
- } from '@/api/hisStore/storeOrder'
- import { getUserList } from "@/api/hisStore/user";
- import { getAddressList } from "@/api/hisStore/userAddress";
- import productOrder from "../components/productOrder";
- import productSelect from "../components/productSelect";
- import addUser from "../components/addUser";
- import addUserAddress from "../components/addUserAddress";
- import { getToken } from "@/utils/auth";
- import QRCode from 'qrcodejs2'
- import { getCompanyList } from "@/api/company/company";
- // import { getTcmScheduleList } from "@/api/company/schedule";
- import { treeselect } from "@/api/company/companyDept";
- import Treeselect from "@riophae/vue-treeselect";
- import "@riophae/vue-treeselect/dist/vue-treeselect.css";
- import { getConfigByKey } from '@/api/system/config'
- import {list as getAppMallOptions} from '@/api/course/coursePlaySourceConfig';
- export default {
- components: { productOrder,productSelect,addUser,addUserAddress,Treeselect },
- name: "HisStoreOrder",
- watch: {
- // 监听deptId
- 'deptId': 'currDeptChange'
- },
- data() {
- return {
- orderStatus:null,
- productInfo:"",
- payPriceTotal:"0",
- payMoneyTotal:"0",
- payRemainTotal:"0",
- // 新增排序相关数据
- currentSort: {
- prop: null,
- order: null
- },
- // 排序字段映射
- sortFieldMap: {
- 'companyUserName': '员工',
- 'packageName': '套餐名称',
- 'payPrice': '应收金额',
- 'payMoney': '实收金额',
- 'createTime': '下单时间'
- },
- erpSettingType:'set',
- SFDFopen:false,
- // 最大订单号数量限制
- maxOrderCodes: {
- type: Number,
- default: 50
- },
- // 输入框是否可见
- inputVisible: false,
- // 无效订单号对话框
- showInvalidDialog: false,
- // 当前输入值
- currentInput: '',
- deptOpen:true,
- // ERP账户相关数据
- erpAccountDialog: {
- open: false,
- title: "选择ERP账户",
- loading: false,
- submitting: false
- },
- erpAccountList: [], // ERP账户列表
- erpAccountQueryList:[], // ERP账户查询条件列表
- erpAccountForm: {
- selectedAccount: [] // 选中的账户ID
- },
- orderSummary: null, // 订单统计信息
- erpPhoneValue:[],
- setPhoneOpen:false,
- erpPhone:{
- open:false,
- title:"设置推送手机号"
- },
- phoneList: [], // 手机号列表
- originalPhoneList: [], // 原始手机号列表,用于取消时恢复
- exportFieldDialog: {
- open: false,
- title: "选择导出字段",
- loading: false,
- type:null
- },
- // 可选择的导出字段列表
- exportFieldOptions: [
- { key: 'orderCode', label: '订单号', checked: true },
- { key: 'miniProgramName', label: '小程序名称', checked: true },
- { key: 'companyName', label: '公司名称', checked: true },
- { key: 'companyUserNickName', label: '所属销售', checked: true },
- { key: 'patientName', label: '就诊人', checked: true },
- { key: 'productName', label: '编号', checked: true },
- { key: 'barCode', label: '药品信息', checked: false },
- { key: 'payMoney', label: '实收金额', checked: true },
- { key: 'payRemain', label: '物流代收金额', checked: false },
- { key: 'payType', label: '支付方式', checked: true },
- { key: 'createTime', label: '下单时间', checked: true },
- { key: 'payTime', label: '支付时间', checked: true },
- { key: 'status', label: '订单状态', checked: true },
- { key: 'userName', label: '收货人姓名', checked: true },
- { key: 'userPhone', label: '收货人电话', checked: true },
- { key: 'userAddress', label: '详细地址', checked: true },
- { key: 'deliveryCode', label: '快递公司编号', checked: false },
- { key: 'deliveryName', label: '快递公司', checked: false },
- { key: 'deliverySn', label: '快递单号', checked: false },
- { key: 'remark', label: '备注', checked: false },
- { key: 'erpPhone', label: 'ERP电话', checked: false },
- { key: 'erpAccount', label: 'ERP账号', checked: false },
- ],
- itemlist : [],
- importMsgOpen:false,
- importMsg:"",
- scheduleOptions:[],
- deliveryPayStatusOptions:[],
- deliveryStatusOptions:[],
- companys:[],
- deptOptions:[],
- companyId:undefined,
- deptId:undefined,
- orderMediumOptions:[],
- orderTypeOptions:[],
- payTypeOptions:[],
- appMallOptions:[],
- payQr:{
- open:false,
- title:"付款二维码"
- },
- user:{
- open:false,
- title:"创建会员"
- },
- userAddress:{
- open:false,
- title:"创建收货地址"
- },
- tablekey:false,
- totalMoney:0.00,
- products:[],
- product:{
- open:false,
- title:"商品选择"
- },
- userStatusOptions:[],
- phone:null,
- address:[],
- addressloading: false,
- userloading: false,
- users:[],
- show:{
- open:false,
- title:"订单详情"
- },
- activeName:"00",
- statusOptions:[],
- // 遮罩层
- loading: true,
- // 选中数组
- ids: [],
- // 非单个禁用
- single: true,
- // 非多个禁用
- multiple: true,
- // 显示搜索条件
- showSearch: true,
- // 总条数
- total: 0,
- // 订单表格数据
- storeOrderList: [],
- // 弹出层标题
- title: "",
- // 是否显示弹出层
- open: false,
- createTimeRange:[],
- payTimeRange:[],
- deliveryImportTimeRange:[],
- deliverySendTimeRange:[],
- orderItemNum:"",
- // 查询参数
- queryParams: {
- pageNum: 1,
- pageSize: 10,
- orderCode: null,
- orderCodes:[],
- extendOrderId: null,
- userId: null,
- realName: null,
- userPhone: null,
- userAddress: null,
- cartId: null,
- freightPrice: null,
- totalNum: null,
- totalPrice: null,
- totalPostage: null,
- payPrice: null,
- payPostage: null,
- deductionPrice: null,
- couponId: null,
- couponPrice: null,
- paid: null,
- payTime: null,
- payType: null,
- status: null,
- refundStatus: null,
- refundReasonWapImg: null,
- refundReasonWapExplain: null,
- refundReasonTime: null,
- refundReasonWap: null,
- refundReason: null,
- refundPrice: null,
- deliverySn: null,
- deliveryName: null,
- deliveryType: null,
- deliveryId: null,
- gainIntegral: null,
- useIntegral: null,
- payIntegral: null,
- backIntegral: null,
- mark: null,
- isDel: null,
- cost: null,
- verifyCode: null,
- storeId: null,
- shippingType: null,
- isChannel: null,
- isRemind: null,
- isSysDel: null,
- deptId:null,
- isUpload:null,
- productName:null,
- },
- // 表单参数
- form: {
- addressId:null,
- userId:null,
- },
- // 表单校验
- rules: {
- userId: [
- { required: true, message: "会员信息不能为空" }
- ],
- addressId: [
- { required: true, message: "收货信息不能为空" }
- ],
- },
- upload: {
- // 是否显示弹出层(用户导入)
- open: false,
- // 弹出层标题(用户导入)
- title: "",
- // 是否禁用上传
- isUploading: false,
- // 是否更新已经存在的用户数据
- updateSupport: 0,
- // 设置上传的请求头部
- headers: { Authorization: "Bearer " + getToken() },
- // 上传的地址
- url: process.env.VUE_APP_BASE_API + "/store/storeOrder/importExpress",
- },
- orderUpload: {
- // 是否显示弹出层(用户导入)
- open: false,
- // 弹出层标题(用户导入)
- title: '',
- // 是否禁用上传
- isUploading: false,
- // 是否更新已经存在的用户数据
- updateSupport: 0,
- // 设置上传的请求头部
- headers: { Authorization: 'Bearer ' + getToken() },
- // 上传的地址
- url: process.env.VUE_APP_BASE_API + '/store/store/storeOrder/importDeliveryNoteExpress',
- },
- deliveryNoteOpen:false,
- miniAppList: [],
- ruleForm:{
- miniAppId: null,
- },
- };
- },
- created() {
- // getCompanyList().then(response => {
- // this.companys = response.data;
- // if(this.companys!=null&&this.companys.length>0){
- // this.companyId=this.companys[0].companyId;
- // this.getTreeselect();
- // }
- // });
- if(process.env.NODE_ENV === "prod-hst"){
- this.getDicts("store_order_medium").then((response) => {
- this.orderMediumOptions = response.data;
- });
- } else {
- this.getDicts("crm_customer_source").then((response) => {
- this.orderMediumOptions = response.data;
- });
- }
- this.getDicts("store_order_type").then((response) => {
- this.orderTypeOptions = response.data;
- });
- this.getDicts("user_status").then((response) => {
- this.userStatusOptions = response.data;
- });
- this.getDicts("store_pay_type").then((response) => {
- this.payTypeOptions = response.data;
- });
- this.getDicts("store_order_status").then((response) => {
- this.statusOptions = response.data;
- });
- this.getDicts("store_order_delivery_status").then((response) => {
- this.deliveryStatusOptions = response.data;
- });
- this.getDicts("store_delivery_pay_status").then((response) => {
- this.deliveryPayStatusOptions = response.data;
- });
- this.getList();
- this.getItemsNum();
- this.getErpAccountList();
- this.getAppMallOptions();
- },
- methods: {
- // 新增排序处理方法
- handleSortChange({ column, prop, order }) {
- console.log('排序变化:', { column, prop, order });
- // 更新当前排序状态
- this.currentSort = {
- prop: prop,
- order: order
- };
- // 更新查询参数
- if (order) {
- this.queryParams.sortField = prop;
- this.queryParams.sortOrder = order === 'ascending' ? 'asc' : 'desc';
- } else {
- this.queryParams.sortField = null;
- this.queryParams.sortOrder = null;
- }
- // 重新查询数据
- this.queryParams.pageNum = 1; // 重置到第一页
- this.getList();
- // 显示排序提示
- if (order) {
- const fieldLabel = this.getSortLabel(prop);
- const orderLabel = order === 'ascending' ? '升序' : '降序';
- this.$message.success(`已按${fieldLabel}${orderLabel}排序`);
- }
- },
- // 获取排序字段的中文标签
- getSortLabel(prop) {
- return this.sortFieldMap[prop] || prop;
- },
- // 清除排序
- clearSort() {
- this.currentSort = {
- prop: null,
- order: null
- };
- this.queryParams.sortField = null;
- this.queryParams.sortOrder = null;
- this.queryParams.pageNum = 1;
- // 重置表格排序状态 - 关键代码
- this.$nextTick(() => {
- if (this.$refs.orderTable) {
- this.$refs.orderTable.clearSort();
- }
- });
- this.getList();
- this.$message.success('已清除排序');
- },
- // 处理键盘按下事件
- handleKeyDown(event) {
- const { key, target } = event
- // 处理退格键删除标签
- if (key === 'Backspace' && !target.value && this.queryParams.orderCodes.length > 0) {
- event.preventDefault()
- this.removeOrderCode(this.queryParams.orderCodes.length - 1)
- }
- // 处理分隔符
- if ([',', ',', ' ', 'Enter'].includes(key)) {
- event.preventDefault()
- this.handleInputConfirm()
- }
- },
- // 处理键盘抬起事件(实时分割输入)
- handleKeyUp(event) {
- const value = event.target.value
- // 检查是否包含分隔符
- if (/[,,\s]/.test(value)) {
- this.handleInputConfirm()
- }
- },
- // 确认输入
- handleInputConfirm() {
- const inputValue = this.currentInput.trim()
- if (inputValue) {
- // 分割多个订单号
- const codes = inputValue.split(/[,,\s]+/).filter(code => code.trim())
- codes.forEach(code => {
- this.addOrderCode(code.trim())
- })
- }
- this.currentInput = ''
- },
- // 添加订单号
- addOrderCode(code) {
- if (!code) return
- // 检查数量限制
- if (this.maxOrderCodes > 0 && this.queryParams.orderCodes.length >= this.maxOrderCodes) {
- this.$message.warning(`最多只能添加 ${this.maxOrderCodes} 个订单号`)
- return
- }
- // 检查重复
- if (this.queryParams.orderCodes.includes(code)) {
- this.$message.warning(`订单号 "${code}" 已存在`)
- return
- }
- // 添加到列表
- this.queryParams.orderCodes.push(code)
- },
- // 清空所有标签
- clearAllTags() {
- this.$confirm('确认清空所有订单号吗?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- this.queryParams.orderCodes = []
- this.$message.success('已清空所有订单号')
- })
- },
- // 显示输入框
- showInput() {
- this.inputVisible = true
- this.$nextTick(() => {
- this.$refs.tagInput.focus()
- })
- },
- // 删除订单号
- removeOrderCode(index) {
- this.queryParams.orderCodes.splice(index, 1)
- },
- // 聚焦输入框
- focusInput() {
- if (!this.inputVisible) {
- this.showInput()
- }
- },
- // 设置erp账户
- showErpAccountSetDialog() {
- this.erpAccountDialog.open = true;
- this.erpSettingType = 'set'
- this.calculateOrderSummary();
- },
- //显示ERP账户选择对话框
- showErpAccountDialog() {
- this.erpAccountDialog.open = true;
- this.erpSettingType = 'push'
- this.calculateOrderSummary();
- },
- //获取ERP账户列表
- async getErpAccountList() {
- try {
- const response = await getErpAccount();
- if (response.code === 200) {
- const list = response.data || [];
- this.erpAccountList = [...list];
- this.erpAccountQueryList = [...list, '未分拣'];
- // 设置默认值:第一条真实账户
- if (list.length && !this.queryParams.erpAccount) {
- this.$set(this.queryParams, 'erpAccount', list[0]);
- this.getList();
- }
- } else {
- this.$message.error(response.msg || '获取ERP账户列表失败');
- this.erpAccountList = [];
- }
- } catch (error) {
- console.error('获取ERP账户列表失败:', error);
- this.$message.error('获取ERP账户列表失败');
- this.erpAccountList = [];
- } finally {
- this.erpAccountDialog.loading = false;
- }
- },
- // 新增:计算订单统计信息
- calculateOrderSummary() {
- let selectedCount = 0;
- let totalAmount = 0;
- let queryCount = this.total || 0;
- if (this.ids.length > 0) {
- // 如果有选中的订单,统计选中的订单
- selectedCount = this.ids.length;
- this.storeOrderList.forEach(order => {
- if (this.ids.includes(order.orderId)) {
- totalAmount += parseFloat(order.payMoney || 0);
- }
- });
- } else {
- // 如果没有选中订单,统计当前查询条件下的所有订单
- selectedCount = queryCount;
- this.storeOrderList.forEach(order => {
- totalAmount += parseFloat(order.payMoney || 0);
- });
- }
- this.orderSummary = {
- selectedCount,
- totalAmount: totalAmount.toFixed(2),
- queryCount
- };
- },
- //确认创建ERP订单
- confirmCreateErpOrder() {
- if (!this.erpAccountForm.selectedAccount) {
- this.$message.warning('请选择ERP账户');
- return;
- }
- console.log("-----------------",this.erpSettingType)
- if(this.erpSettingType == 'set'){
- this.$confirm(
- `确认将订单设置ERP账户为"${this.erpAccountForm.selectedAccount}"吗?`,
- '确认',
- {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }
- ).then(() => {
- this.executSetErpOrder();
- });
- } else if(this.erpSettingType == 'push'){
- this.$confirm(
- `确认将订单推送到ERP账户"${this.erpAccountForm.selectedAccount}"吗?`,
- '确认推送',
- {
- confirmButtonText: '确定推送',
- cancelButtonText: '取消',
- type: 'warning'
- }
- ).then(() => {
- this.executeCreateErpOrder();
- });
- }
- },
- async executSetErpOrder() {
- this.erpAccountDialog.submitting = true;
- try {
- let param = {
- loginAccount: this.erpAccountForm.selectedAccount
- };
- if (this.ids.length > 0) {
- // 如果有选中的订单,只推送选中的
- param.orderIds = this.ids;
- } else {
- // 如果没有选中订单,推送查询条件下的所有订单
- // 合并查询参数
- param = { ...param, ...this.queryParams };
- }
- const response = await batchSetErpOrder(param);
- if (response.code === 200) {
- this.$message.success('订单ERP账号设置成功');
- this.cancelErpAccountDialog();
- this.getErpAccountList(); // 刷新列表
- this.getList();
- } else {
- this.$message.error(response.msg || 'ERP账号设置失败');
- }
- } catch (error) {
- console.error('ERP账号设置失败:', error);
- this.$message.error('ERP账号设置失败');
- } finally {
- this.erpAccountDialog.submitting = false;
- }
- },
- //执行创建ERP订单
- async executeCreateErpOrder() {
- this.erpAccountDialog.submitting = true;
- try {
- let param = {
- loginAccount: this.erpAccountForm.selectedAccount
- };
- if (this.ids.length > 0) {
- // 如果有选中的订单,只推送选中的
- param.orderIds = this.ids;
- } else {
- // 如果没有选中订单,推送查询条件下的所有订单
- // 合并查询参数
- param = { ...param, ...this.queryParams };
- }
- const response = await batchCreateErpOrder(param);
- if (response.code === 200) {
- this.$message.success('ERP订单创建成功');
- this.cancelErpAccountDialog();
- this.getErpAccountList(); // 刷新列表
- this.getList();
- } else {
- this.$message.error(response.msg || 'ERP订单创建失败');
- }
- } catch (error) {
- console.error('创建ERP订单失败:', error);
- this.$message.error('创建ERP订单失败');
- } finally {
- this.erpAccountDialog.submitting = false;
- }
- },
- // 新增:取消ERP账户选择对话框
- cancelErpAccountDialog() {
- this.erpAccountDialog.open = false;
- this.erpAccountForm.selectedAccount = null;
- this.orderSummary = null;
- this.erpAccountList = [];
- },
- handleCancelErpPhone(){
- this.erpPhoneValue = [];
- this.setPhoneOpen = false;
- },
- submitErpPhone(){
- let param = {};
- if(this.ids.length>0){
- param = {orderIds:this.ids,erpPhone:this.erpPhoneValue};
- } else {
- param = this.queryParams;
- param.erpPhone=this.erpPhoneValue;
- }
- editErpPhone(param).then(response=>{
- this.msgSuccess("修改成功");
- this.setPhoneOpen = false;
- this.getList();
- })
- },
- setErpPhone(){
- this.getErpPhoneList();
- this.setPhoneOpen = true;
- },
- // 设置推送手机相关方法
- handleErpPhone(){
- //查询配置手机号
- this.getErpPhoneList();
- this.erpPhone.open = true
- },
- getErpPhoneList(){
- queryErpPhone().then(response =>{
- if(response.data && response.data != null && response.data.length >0){
- const phones = response.data.filter(phone => phone.trim());
- this.phoneList = phones.map(phone => ({
- phone: phone.trim(),
- editing: false,
- originalPhone: phone.trim()
- }));
- }
- // 保存原始数据用于取消操作
- this.originalPhoneList = this.phoneList;
- });
- },
- // 新增手机号
- handleAddPhone() {
- this.phoneList.push({
- phone: '',
- editing: true,
- originalPhone: '',
- isNew: true
- });
- },
- // 编辑手机号
- handleEditPhone(index) {
- this.$set(this.phoneList[index], 'editing', true);
- this.$set(this.phoneList[index], 'originalPhone', this.phoneList[index].phone);
- },
- // 保存手机号
- handleSavePhone(index) {
- const phone = this.phoneList[index].phone.trim();
- if (!phone) {
- this.$message.error('手机号不能为空');
- return;
- }
- if (!this.validatePhoneFormat(phone)) {
- this.$message.error('请输入正确的手机号格式');
- return;
- }
- // 检查是否重复
- const duplicateIndex = this.phoneList.findIndex((item, idx) =>
- idx !== index && item.phone === phone
- );
- if (duplicateIndex !== -1) {
- this.$message.error('手机号已存在');
- return;
- }
- this.$set(this.phoneList[index], 'editing', false);
- this.$set(this.phoneList[index], 'isNew', false);
- },
- // 取消编辑
- handleCancelEdit(index) {
- if (this.phoneList[index].isNew) {
- // 如果是新增的,直接删除
- this.phoneList.splice(index, 1);
- } else {
- // 如果是编辑的,恢复原值
- this.$set(this.phoneList[index], 'phone', this.phoneList[index].originalPhone);
- this.$set(this.phoneList[index], 'editing', false);
- }
- },
- // 删除手机号
- handleDeletePhone(index) {
- this.$confirm('确认删除该手机号?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- this.phoneList.splice(index, 1);
- this.$message.success('删除成功');
- });
- },
- // 验证手机号格式
- validatePhoneFormat(phone) {
- const phoneRegex = /^1[3-9]\d{9}$/;
- return phoneRegex.test(phone);
- },
- // 验证手机号
- validatePhone(row) {
- if (row.phone && !this.validatePhoneFormat(row.phone)) {
- this.$message.error('请输入正确的手机号格式');
- }
- },
- // 保存手机号列表
- handleSavePhoneList() {
- // 检查是否有正在编辑的项
- const editingItem = this.phoneList.find(item => item.editing);
- if (editingItem) {
- this.$message.error('请先保存正在编辑的手机号');
- return;
- }
- // 检查是否有空的手机号
- const emptyPhone = this.phoneList.find(item => !item.phone.trim());
- if (emptyPhone) {
- this.$message.error('存在空的手机号,请删除或填写完整');
- return;
- }
- // 构造手机号列表
- const phoneList = this.phoneList.map(item => item.phone);
- // 调用保存接口
- saveErpPhone(phoneList).then(response => {
- if (response.code === 200) {
- this.$message.success('保存成功');
- this.erpPhone.open = false;
- } else {
- this.$message.error(response.msg || '保存失败');
- }
- this.getList();
- }).catch(() => {
- this.$message.error('保存失败');
- });
- },
- // 取消手机号对话框
- handleCancelPhoneDialog() {
- // 恢复原始数据
- this.phoneList = JSON.parse(JSON.stringify(this.originalPhoneList));
- this.erpPhone.open = false;
- },
- // 获取小程序选项列表
- getAppMallOptions() {
- getAppMallOptions({pageNum:1,pageSize:100,isMall:1}).then(response => {
- this.appMallOptions = response.rows;
- })
- },
- // 获取已选择字段数量
- getSelectedFieldsCount() {
- return this.exportFieldOptions.filter(field => field.checked).length;
- },
- // 取消导出字段选择
- cancelExportFieldDialog() {
- this.exportFieldDialog.open = false;
- this.exportFieldDialog.type = null;
- },
- // 选择常用字段
- selectDefaultFields() {
- // 先全不选
- this.unselectAllFields();
- // 然后选择常用字段
- const defaultFields = ['orderCode', 'prescribeCode', 'companyName', 'companyUserNickName',
- 'storeName', 'miniProgramName', 'userName', 'userPhone', 'userAddress', 'totalPrice',
- 'totalNum', 'payPrice', 'payMoney', 'createTime', 'payTime',
- 'payType', 'status', 'packageName', 'patientName'];
- this.exportFieldOptions.forEach(field => {
- if (defaultFields.includes(field.key)) {
- field.checked = true;
- }
- });
- },
- // 确认导出字段
- confirmExportFields() {
- // 获取已选择的字段
- const selectedFieldsArray = this.exportFieldOptions.filter(field => field.checked);
- let selectedFields = '';
- if (selectedFieldsArray.length === 0) {
- // 如果没有选择任何字段,则导出全部字段(不传filter参数)
- selectedFields = null;
- } else {
- // 如果选择了字段,则只导出选中的字段
- selectedFields = selectedFieldsArray.map(field => field.key).join(',');
- }
- // 关闭弹窗
- this.exportFieldDialog.open = false;
- // 执行导出操作
- this.doExportOrder(selectedFields);
- },
- // 执行导出操作
- doExportOrder(selectedFields) {
- if(this.queryParams.status=='00'){
- this.queryParams.status=null;
- }
- if(this.createTimeRange!=null&&this.createTimeRange.length==2){
- this.queryParams.createTimeRange=this.createTimeRange[0]+"--"+this.createTimeRange[1]
- }
- else{
- this.queryParams.createTimeRange=null;
- }
- if(this.payTimeRange!=null&&this.payTimeRange.length==2){
- this.queryParams.payTimeRange=this.payTimeRange[0]+"--"+this.payTimeRange[1]
- }
- else{
- this.queryParams.payTimeRange=null;
- }
- if(this.deliveryImportTimeRange!=null&&this.deliveryImportTimeRange.length==2){
- this.queryParams.deliveryImportTimeRange=this.deliveryImportTimeRange[0]+"--"+this.deliveryImportTimeRange[1]
- }
- else{
- this.queryParams.deliveryImportTimeRange=null;
- }
- if(this.deliverySendTimeRange!=null&&this.deliverySendTimeRange.length==2){
- this.queryParams.deliverySendTimeRange=this.deliverySendTimeRange[0]+"--"+this.deliverySendTimeRange[1]
- }
- else{
- this.queryParams.deliverySendTimeRange=null;
- }
- const queryParams = this.addDateRange(this.queryParams, this.dateRange);
- // 根据是否选择字段显示不同的确认消息
- let confirmMessage = '';
- if (selectedFields === null) {
- confirmMessage = '没有选择字段,将导出所有字段的订单数据,确认继续?';
- } else {
- const fieldCount = selectedFields.split(',').length;
- confirmMessage = `确认导出选中的 ${fieldCount} 个字段的订单数据?`;
- }
- this.$confirm('是否确认导出所有订单数据项?', "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(()=> {
- this.exportLoading = true;
- // 构建请求参数
- const requestParams = {...queryParams};
- // 只有当selectedFields不为null时才添加filter参数
- if (selectedFields !== null) {
- requestParams.filter = selectedFields;
- }
- console.log(requestParams)
- if(this.exportFieldDialog.type == 1){
- return exportStoreOrder(requestParams);
- } else if (this.exportFieldDialog.type == 2){
- return exportStoreOrderDetails(requestParams);
- }
- }).then(response => {
- this.download(response.msg);
- }).catch(function() {});
- },
- // 导出字段选择相关方法
- // 全选字段
- selectAllFields() {
- this.exportFieldOptions.forEach(field => {
- field.checked = true;
- });
- },
- // 全不选字段
- unselectAllFields() {
- this.exportFieldOptions.forEach(field => {
- field.checked = false;
- });
- },
- handleGenPayUrl(row){
- this.payQr.open=true;
- setTimeout(() => {
- var qrcode = new QRCode(this.$refs.qrCodeUrl, {
- text: config.payQRUrl+row.id, // 需要转换为二维码的内容
- width: 200,
- height: 200,
- colorDark: '#000000',
- colorLight: '#ffffff',
- correctLevel: QRCode.CorrectLevel.H
- })
- }, 200);
- },
- handleAddUser(){
- this.user.open=true;
- },
- handleAddUserAddress(){
- if(this.form.userId==null){
- this.msgError("请选择会员");
- return;
- }
- this.userAddress.open=true;
- setTimeout(() => {
- this.$refs.addUserAddress.init(this.form.userId);
- }, 500);
- },
- addUser(){
- this.user.open=false;
- },
- addUserAddress(){
- this.userAddress.open=false;
- //获取地址
- this.getAddressList(this.form.userId);
- },
- compute(){
- this.totalMoney=0;
- var that=this;
- this.products.forEach (function (value) {
- that.totalMoney += value.money;
- });
- console.log(that.totalMoney)
- },
- handleProductCountChange(row){
- this.tablekey = !this.tablekey
- console.log(row)
- row.money=row.count*row.price;
- this.$forceUpdate();
- this.compute();
- },
- selectProduct(row){
- console.log(row);
- for(var i=0;i<this.products.length;i++){
- if(this.products[i].id==row.id){
- return;
- }
- }
- row.count=1;
- row.money=row.count*row.price;
- this.products.push(row);
- this.compute();
- },
- handleAddProduct(){
- this.product.open=true;
- },
- searchUser(){
- if(this.phone==null||this.phone==""){
- return;
- }
- var data={phone:this.phone}
- this.userloading = true;
- this.users=[];
- this.address=[];
- getUserList(data).then(response => {
- this.users = response.data;
- this.userloading = false;
- if(this.users!=null&&this.users.length==1){
- this.form.userId=this.users[0].userId;
- this.getAddressList(this.form.userId)
- }
- });
- },
- getAddressList(userId){
- var data={userId:userId}
- this.addressloading = true;
- this.address=[];
- getAddressList(data).then(response => {
- this.address = response.data;
- this.addressloading = false;
- });
- },
- handleDetails(row){
- this.show.open=true;
- const orderId = row.id ;
- setTimeout(() => {
- this.$refs.order.getOrder(orderId);
- }, 500);
- },
- handleClick(tab, event) {
- this.orderStatus = tab.name;
- this.activeName=tab.name;
- this.queryParams.status=tab.name
- console.log(this.queryParams.status)
- this.getList();
- },
- /** 查询订单列表 */
- getList() {
- this.loading = true;
- if(this.queryParams.status=='00'){
- this.queryParams.status=null;
- }
- if(this.createTimeRange!=null&&this.createTimeRange.length==2){
- this.queryParams.createTimeRange=this.createTimeRange[0]+"--"+this.createTimeRange[1]
- }
- else{
- this.queryParams.createTimeRange=null;
- }
- if(this.payTimeRange!=null&&this.payTimeRange.length==2){
- this.queryParams.payTimeRange=this.payTimeRange[0]+"--"+this.payTimeRange[1]
- }
- else{
- this.queryParams.payTimeRange=null;
- }
- if(this.deliveryImportTimeRange!=null&&this.deliveryImportTimeRange.length==2){
- this.queryParams.deliveryImportTimeRange=this.deliveryImportTimeRange[0]+"--"+this.deliveryImportTimeRange[1]
- }
- else{
- this.queryParams.deliveryImportTimeRange=null;
- }
- if(this.deliverySendTimeRange!=null&&this.deliverySendTimeRange.length==2){
- this.queryParams.deliverySendTimeRange=this.deliverySendTimeRange[0]+"--"+this.deliverySendTimeRange[1]
- }
- else{
- this.queryParams.deliverySendTimeRange=null;
- }
- // 处理订单号数组
- if (this.queryParams.orderCodes && this.queryParams.orderCodes.length > 0) {
- this.queryParams.orderCodeList = this.queryParams.orderCodes.join(',');
- } else {
- this.queryParams.orderCodeList = null;
- }
- listStoreOrder(this.queryParams).then(response => {
- this.storeOrderList = response.rows;
- this.total = response.total;
- if(this.total>0){
- this.payPriceTotal = response.payPriceTotal;
- this.payMoneyTotal = response.payMoneyTotal;
- this.payRemainTotal = response.payRemainTotal;
- this.productInfo = response.productInfo;
- } else {
- this.payPriceTotal = "0"
- this.payMoneyTotal = "0"
- this.payRemainTotal = "0"
- this.productInfo = response.productInfo;
- }
- this.loading = false;
- if(response.msg == 'knt'){
- this.SFDFopen = true;
- } else{
- this.SFDFopen = false;
- }
- // 如果有排序,显示排序结果提示
- if (this.currentSort.prop) {
- const fieldLabel = this.getSortLabel(this.currentSort.prop);
- const orderLabel = this.currentSort.order === 'ascending' ? '升序' : '降序';
- console.log(`数据已按${fieldLabel}${orderLabel}加载`);
- }
- }).catch(error => {
- console.error('查询失败:', error);
- this.loading = false;
- this.$message.error('查询数据失败');
- });
- },
- getItemsNum() {
- this.loading = true;
- if(this.queryParams.status=='00'){
- this.queryParams.status=null;
- }
- if(this.createTimeRange!=null&&this.createTimeRange.length==2){
- this.queryParams.createTimeRange=this.createTimeRange[0]+"--"+this.createTimeRange[1]
- }
- else{
- this.queryParams.createTimeRange=null;
- }
- if(this.payTimeRange!=null&&this.payTimeRange.length==2){
- this.queryParams.payTimeRange=this.payTimeRange[0]+"--"+this.payTimeRange[1]
- }
- else{
- this.queryParams.payTimeRange=null;
- }
- if(this.deliveryImportTimeRange!=null&&this.deliveryImportTimeRange.length==2){
- this.queryParams.deliveryImportTimeRange=this.deliveryImportTimeRange[0]+"--"+this.deliveryImportTimeRange[1]
- }
- else{
- this.queryParams.deliveryImportTimeRange=null;
- }
- if(this.deliverySendTimeRange!=null&&this.deliverySendTimeRange.length==2){
- this.queryParams.deliverySendTimeRange=this.deliverySendTimeRange[0]+"--"+this.deliverySendTimeRange[1]
- }
- else{
- this.queryParams.deliverySendTimeRange=null;
- }
- getOrderItemsNum(this.queryParams).then(response => {
- this.orderItemNum = response.orderItemsNum;
- this.loading = false;
- });
- },
- // 取消按钮
- cancel() {
- this.open = false;
- this.reset();
- },
- // 表单重置
- reset() {
- this.form = {
- addressId:null,
- userId:null,
- };
- this.resetForm("form");
- },
- /** 搜索按钮操作 */
- handleQuery() {
- this.queryParams.pageNum = 1;
- this.getList();
- this.getItemsNum();
- },
- /** 重置按钮操作 */
- resetQuery() {
- this.payTimeRange = []
- this.createTimeRange = []
- this.deliverySendTimeRange = []
- this.deliveryImportTimeRange = []
- this.resetForm("queryForm");
- // 清除排序
- this.currentSort = {
- prop: null,
- order: null
- };
- this.queryParams.sortField = null;
- this.queryParams.sortOrder = null;
- // 重置表格排序状态 - 关键代码
- this.$nextTick(() => {
- if (this.$refs.orderTable) {
- this.$refs.orderTable.clearSort();
- }
- });
- this.handleQuery();
- },
- // 多选框选中数据
- handleSelectionChange(selection) {
- this.ids = selection.map(item => item.id)
- this.single = selection.length!==1
- this.multiple = !selection.length
- },
- /** 新增按钮操作 */
- handleAdd() {
- this.reset();
- this.open = true;
- this.title = "创建订单";
- },
- /** 修改按钮操作 */
- handleUpdate(row) {
- this.reset();
- const id = row.id || this.ids
- getStoreOrder(id).then(response => {
- this.form = response.data;
- this.open = true;
- this.title = "修改订单";
- });
- },
- /** 提交按钮 */
- submitForm() {
- this.$refs["form"].validate(valid => {
- this.form.products=this.products;
- if (valid) {
- console.log(this.form);
- createUserOrder(this.form).then(response => {
- if (response.code === 200) {
- this.msgSuccess("创建成功");
- this.open = false;
- this.getList();
- }
- });
- }
- });
- },
- /** 删除按钮操作 */
- handleDelete(row) {
- this.products.splice(this.products.findIndex(item => item.id === row.id), 1)
- this.compute();
- },
- /** 删除按钮操作 */
- handleOrderDelete(row) {
- const ids = row.id || this.ids;
- this.$confirm('是否确认删除当前选择的订单数据项?', "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(function () {
- return delStoreOrder(ids);
- }).then(() => {
- this.getList();
- this.msgSuccess("删除成功");
- }).catch(() => {
- });
- },
- /** 导出按钮操作 */
- handleOrderExport() {
- // 打开字段选择对话框
- this.exportFieldDialog.open = true;
- this.exportFieldDialog.type = 1;
- },
- handleExportItemsDetails() {
- if(this.queryParams.status=='00'){
- this.queryParams.status=null;
- }
- if(this.createTimeRange!=null&&this.createTimeRange.length==2){
- this.queryParams.createTimeRange=this.createTimeRange[0]+"--"+this.createTimeRange[1]
- }
- else{
- this.queryParams.createTimeRange=null;
- }
- if(this.payTimeRange!=null&&this.payTimeRange.length==2){
- this.queryParams.payTimeRange=this.payTimeRange[0]+"--"+this.payTimeRange[1]
- }
- else{
- this.queryParams.payTimeRange=null;
- }
- if(this.deliveryImportTimeRange!=null&&this.deliveryImportTimeRange.length==2){
- this.queryParams.deliveryImportTimeRange=this.deliveryImportTimeRange[0]+"--"+this.deliveryImportTimeRange[1]
- }
- else{
- this.queryParams.deliveryImportTimeRange=null;
- }
- if(this.deliverySendTimeRange!=null&&this.deliverySendTimeRange.length==2){
- this.queryParams.deliverySendTimeRange=this.deliverySendTimeRange[0]+"--"+this.deliverySendTimeRange[1]
- }
- else{
- this.queryParams.deliverySendTimeRange=null;
- }
- const queryParams = this.addDateRange(this.queryParams, this.dateRange);
- this.$confirm('是否确认导出所有订单明细数据项?', "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(function() {
- return exportStoreOrderItemsDetails(queryParams);
- }).then(response => {
- this.download(response.msg);
- }).catch(function() {});
- },
- /** 导出按钮操作 */
- handleExportDetails() {
- this.exportFieldDialog.open = true;
- this.exportFieldDialog.type = 2;
- },
- handleExportItems() {
- if(this.queryParams.status=='00'){
- this.queryParams.status=null;
- }
- if(this.createTimeRange!=null&&this.createTimeRange.length==2){
- this.queryParams.createTimeRange=this.createTimeRange[0]+"--"+this.createTimeRange[1]
- }
- else{
- this.queryParams.createTimeRange=null;
- }
- if(this.payTimeRange!=null&&this.payTimeRange.length==2){
- this.queryParams.payTimeRange=this.payTimeRange[0]+"--"+this.payTimeRange[1]
- }
- else{
- this.queryParams.payTimeRange=null;
- }
- if(this.deliveryImportTimeRange!=null&&this.deliveryImportTimeRange.length==2){
- this.queryParams.deliveryImportTimeRange=this.deliveryImportTimeRange[0]+"--"+this.deliveryImportTimeRange[1]
- }
- else{
- this.queryParams.deliveryImportTimeRange=null;
- }
- if(this.deliverySendTimeRange!=null&&this.deliverySendTimeRange.length==2){
- this.queryParams.deliverySendTimeRange=this.deliverySendTimeRange[0]+"--"+this.deliverySendTimeRange[1]
- }
- else{
- this.queryParams.deliverySendTimeRange=null;
- }
- const queryParams = this.addDateRange(this.queryParams, this.dateRange);
- this.$confirm('是否确认导出所有订单明细数据项?', "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(function() {
- return exportStoreOrderItems(queryParams);
- }).then(response => {
- this.download(response.msg);
- }).catch(function() {});
- },
- handleImport() {
- this.upload.title = "导入银行回单";
- this.upload.open = true;
- },
- submitFileForm() {
- this.$refs.upload.submit();
- },
- handleDownloadTemplate() {
- console.log("===== 点击了下载模板,进入 importTemplate 方法 ====="); // 新增这行
- importTemplate().then((response) => {
- console.log("接口返回的下载链接:", response.msg);
- this.download(response.msg);
- }).catch((error) => {
- console.error("下载模板接口调用失败:", error); // 新增失败回调日志
- });
- },
- // 文件上传中处理
- handleFileUploadProgress(event, file, fileList) {
- this.upload.isUploading = true;
- },
- // 文件上传成功处理
- handleFileSuccess(response, file, fileList) {
- this.upload.open = false;
- this.upload.isUploading = false;
- this.$refs.upload.clearFiles();
- this.importMsgOpen=true;
- this.importMsg=response.msg
- // this.$alert(response.msg, '导入结果', {
- // dangerouslyUseHTMLString: true
- // });
- this.getList();
- },
- /** 查询部门下拉树结构 */
- getTreeselect() {
- var that=this;
- var param={companyId:this.companyId}
- treeselect(param).then((response) => {
- this.deptOptions = response.data;
- console.log(this.deptOptions)
- if(response.data!=null&&response.data.length>0){
- //this.queryParams.deptId=response.data[0].id;
- }
- });
- },
- companyChange(val){
- console.log(val);
- this.companyId=val;
- this.getTreeselect();
- },
- currDeptChange(val){
- console.log(val)
- this.queryParams.deptId=val;
- this.getList();
- },
- //打开发货单
- openDeliveryNote(){
- this.deliveryNoteOpen=true;
- // this.getAppList();
- },
- handleClose(done) {
- this.$confirm('确认关闭?')
- .then(_ => {
- done();
- })
- .catch(_ => {});
- },
- //发货单模板下载
- importDeliveryNoteTemplate(){
- importDeliveryNoteExpressTemplate().then((response) => {
- this.download(response.msg)
- })
- },
- getAppList() {
- this.miniAppList = []
- const key = "courseMa.config"
- getConfigByKey(key).then(response => {
- const {code,data} = response
- if (code === 200) {
- let value = data?.configValue
- if (value) {
- console.log("打印-----------------》",value)
- const appList = JSON.parse(value);
- this.miniAppList = appList.filter(v => v.type === '1').map(v => {
- return { appId: v.appid, appName: v.name }
- })
- }
- }
- })
- },
- // 提交发货单
- submitDeliveryNote() {
- const uploadFiles = this.$refs.upload.uploadFiles;
- if (uploadFiles.length === 0) {
- this.$message.error('请选择要上传的文件');
- return;
- }
- this.$refs.upload.submit();
- },
- }
- };
- </script>
- <style scoped lang="scss">
- .items{
- margin: 5px 0px;
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: flex-start;
- .pic{
- width:60px;
- height:60px;
- }
- .goods-content{
- margin-left: 10px;
- max-width: 200px;
- text-align: left;
- .goods-title{
- overflow:hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- -o-text-overflow:ellipsis;
- }
- }
- }
- .el-message-box__message p{
- max-height: 400px;
- overflow:scroll;
- }
- .import-msg{
- height: 500px;
- overflow: auto;
- }
- </style>
- <style>
- .el-descriptions-item__label.is-bordered-label{
- font-weight: normal;
- }
- </style>
- <style scoped>
- .tag-input-order-search {
- padding: 20px;
- background: #fff;
- border-radius: 4px;
- }
- .tag-input-container {
- min-width: 445px;
- }
- .tags-wrapper {
- min-height: 32px;
- padding: 4px 8px;
- border: 1px solid #dcdfe6;
- border-radius: 4px;
- cursor: text;
- display: flex;
- flex-wrap: wrap;
- align-items: center;
- gap: 4px;
- transition: border-color 0.2s;
- }
- .tags-wrapper:hover {
- border-color: #c0c4cc;
- }
- .tags-wrapper:focus-within {
- border-color: #409eff;
- box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.2);
- }
- .order-tag {
- margin: 2px;
- flex-shrink: 0;
- }
- .tag-error {
- background-color: #fef0f0;
- border-color: #fbc4c4;
- color: #f56c6c;
- }
- .tag-input {
- border: none;
- outline: none;
- flex: 1;
- min-width: 120px;
- }
- .tag-input >>> .el-input__inner {
- border: none;
- padding: 0;
- height: 24px;
- line-height: 24px;
- }
- .button-new-tag {
- height: 24px;
- line-height: 22px;
- padding: 0 8px;
- margin: 2px;
- }
- .input-tips {
- margin-top: 4px;
- font-size: 12px;
- color: #909399;
- }
- /* 新增排序相关样式 */
- .sort-info {
- margin-top: 10px;
- padding: 8px 0;
- }
- /* 表格布局优化 */
- .el-table {
- min-width: 100%;
- table-layout: fixed;
- }
- .el-table .el-table__body-wrapper {
- overflow-x: auto;
- }
- .tip-text {
- display: flex;
- align-items: center;
- gap: 8px;
- }
- .quick-actions {
- margin-top: 12px;
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 8px 0;
- border-top: 1px solid #ebeef5;
- }
- .stats-info {
- font-size: 12px;
- color: #909399;
- display: flex;
- align-items: center;
- gap: 4px;
- }
- .invalid-codes-list {
- margin: 16px 0;
- max-height: 200px;
- overflow-y: auto;
- }
- .invalid-tag {
- margin: 4px;
- }
- .debug-preview {
- margin-top: 20px;
- }
- .debug-content {
- font-size: 12px;
- }
- .debug-content code {
- display: block;
- background: #f5f5f5;
- padding: 8px;
- border-radius: 4px;
- margin: 4px 0 12px 0;
- white-space: pre-wrap;
- }
- /* 响应式设计 */
- @media (max-width: 768px) {
- .tag-input-container {
- min-width: auto;
- width: 100%;
- }
- .tags-wrapper {
- min-height: 40px;
- }
- .quick-actions {
- flex-direction: column;
- align-items: flex-start;
- gap: 8px;
- }
- }
- </style>
|