detailsPage.vue 88 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546
  1. <template>
  2. <div>
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left" @click="backToList(0)"
  6. >返回列表
  7. </el-button>
  8. </div>
  9. <div class="add-customer-btn">
  10. <el-button class="el-button&#45;&#45;small-yh" style="margin-left: 6px;" type="primary" size="small" v-if="editButton" @click="confirmEditing"
  11. >编 辑
  12. </el-button>
  13. <el-button
  14. class="el-button--small-yh"
  15. v-else
  16. style="margin-left: 6px;"
  17. type="primary"
  18. size="small"
  19. :disabled="isSaveBtn"
  20. @click="editCustomer"
  21. >保 存
  22. </el-button>
  23. <el-button
  24. class="el-button--small-yh"
  25. style="margin-left: 6px;"
  26. :type="buttonColor"
  27. size="small"
  28. :disabled="isDisabledTask || (form.status !== '待确认' && form.status !== '待收货')"
  29. @click="generateOutbound"
  30. >
  31. {{ buttonText }}
  32. </el-button>
  33. <el-button
  34. class="el-button--small-yh"
  35. style="margin-left: 6px;"
  36. type="info"
  37. size="small"
  38. :disabled="form.status != '已收货' || form.returnsNumber == form.goodsTotalNum || editButton"
  39. @click="getReturns"
  40. >
  41. 采购退货
  42. </el-button>
  43. <el-dropdown style="padding: 0 6px;line-height: 0">
  44. <el-button v-show="!(!form.id || viewDisabled)" type="danger" :loading="buttonLoading" :disabled="!form.id || viewDisabled" size="small">
  45. 请 核<i class="el-icon-arrow-down el-icon--right"></i>
  46. </el-button>
  47. <el-dropdown-menu slot="dropdown">
  48. <el-dropdown-item @click.native="applySettlement('申请')" :disabled="isApplySettlement || form.status !== '录入'"
  49. >请核数据
  50. </el-dropdown-item>
  51. <!-- <el-dropdown-item @click.native="confirmRefundBtn('确认')" :disabled="isConfirmRefundBtn">确认退款
  52. </el-dropdown-item> -->
  53. <el-dropdown-item @click.native="revocationRequest('撤销')" :disabled="isRevocationRequest">撤销请核 </el-dropdown-item>
  54. </el-dropdown-menu>
  55. </el-dropdown>
  56. <el-dropdown style="line-height: 0">
  57. <el-button type="warning" :loading="buttonLoading" :disabled="!form.id || viewDisabled" size="small">
  58. 审 批<i class="el-icon-arrow-down el-icon--right"></i>
  59. </el-button>
  60. <el-dropdown-menu slot="dropdown">
  61. <el-dropdown-item @click.native="examineBtn('审批')" :disabled="(isExamineBtn && !detailData.check) || form.checkStatus == '审核完成'"
  62. >审批
  63. </el-dropdown-item>
  64. <el-dropdown-item @click.native="(checkScheduleDialog = true), (checkId = form.id)">审核进度 </el-dropdown-item>
  65. </el-dropdown-menu>
  66. </el-dropdown>
  67. <!--<el-button class="el-button&#45;&#45;small-yh" style="margin-left: 6px;" v-if="form.id"-->
  68. <!-- type="success" size="small"-->
  69. <!-- :disabled="form.shortcutWarehousingStatus == '1' || form.status != '录入' || editButton"-->
  70. <!-- @click="oneClickStorage" >一键采购入库-->
  71. <!--</el-button>-->
  72. </div>
  73. </div>
  74. <div style="margin-top: 50px">
  75. <trade-card title="基础信息">
  76. <avue-form :option="optionForm" v-model="form" ref="form">
  77. <template slot-scope="{ row, index }" slot="contacts">
  78. <!-- 联系人 -->
  79. <el-select
  80. v-model="form.contacts"
  81. placeholder="请选择"
  82. size="small"
  83. style="width:60%"
  84. clearable
  85. filterable
  86. allow-create
  87. default-first-option
  88. @change="contactsChange($event)"
  89. :disabled="isContacts"
  90. >
  91. <el-option v-for="item in contactsOption" :key="item.cname" :label="item.cname" :value="item.contacts" />
  92. </el-select>
  93. </template>
  94. <template slot-scope="{ row, index }" slot="recAddress">
  95. <!-- 地址 -->
  96. <el-select
  97. v-model="form.recAddress"
  98. placeholder="请选择"
  99. size="small"
  100. style="width:60%"
  101. clearable
  102. filterable
  103. allow-create
  104. default-first-option
  105. :disabled="isContacts"
  106. >
  107. <el-option
  108. v-for="item in recAddressOption"
  109. :key="item.id"
  110. :label="item.belongtoarea + item.detailedAddress"
  111. :value="item.belongtoarea + item.detailedAddress"
  112. />
  113. </el-select>
  114. </template>
  115. </avue-form>
  116. </trade-card>
  117. <trade-card title="明细信息">
  118. <el-tabs v-model="activeName" type="card">
  119. <el-tab-pane label="采购明细" name="sale_detail">
  120. <avue-crud
  121. :option="optionContacts"
  122. v-model="formContacts"
  123. ref="formContacts"
  124. :data="form.orderItemsList"
  125. :key="key"
  126. @row-save="rowSave"
  127. @row-update="rowUpdate"
  128. @row-close="rowClose"
  129. :before-close="beforeClose"
  130. @selection-change="selectionContacts"
  131. @resetColumn="resetColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 269.1)"
  132. @saveColumn="saveColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 269.1)"
  133. >
  134. <template slot-scope="{ scope, row }" slot="menuLeft">
  135. <el-button type="primary" icon="el-icon-plus" size="small" :disabled="isAddBtn" @click="rowAdd(row)">添加商品</el-button>
  136. <el-button type="success" size="small" :disabled="isAddBtn" icon="el-icon-bottom" @click="excelDialogfun('名称')"
  137. >按名称导入
  138. </el-button>
  139. <el-button type="success" size="small" :disabled="isAddBtn" icon="el-icon-bottom" @click="excelDialogfun('code')"
  140. >按Code导入
  141. </el-button>
  142. <el-button type="primary" icon="el-icon-printer" size="small" @click="handlePrint">打印</el-button>
  143. <el-button type="danger" plain size="small" @click="batchDelete" :disabled="form.status != '录入' || editButton">一键删除</el-button>
  144. </template>
  145. <template slot="goodsId" slot-scope="{ row }">
  146. <!--<el-select v-if="row.$cellEdit" v-model="row.goodsId" allow-create filterable default-first-option >-->
  147. <!-- <el-option v-for="(item, index) in goodsIdoptions" :key="index" :label="item.cname"-->
  148. <!-- :value="item.id"></el-option>-->
  149. <!--</el-select>-->
  150. <span>{{ row.goodsName }}</span>
  151. </template>
  152. <template slot="goodsNum" slot-scope="{ row }">
  153. <el-input-number
  154. v-if="!mingxibaocun"
  155. size="small"
  156. v-model="row.goodsNum"
  157. :controls="false"
  158. :precision="numberDecimal"
  159. style="width: 100%"
  160. ></el-input-number>
  161. <span v-else>{{ row.goodsNum }}</span>
  162. </template>
  163. <template slot="sendNum" slot-scope="{ row }">
  164. <el-popover width="600" trigger="click">
  165. <avue-crud :data="areaData" :option="areaOption"></avue-crud>
  166. <span style="color: #409EFF;cursor: pointer" slot="reference" @click="viewArea(row)">{{ row.sendNum }}</span>
  167. </el-popover>
  168. </template>
  169. <template slot="price" slot-scope="{ row }">
  170. <el-input v-if="!mingxibaocun" size="small" v-model="row.price" style="width: 100%"></el-input>
  171. <span v-else>{{ row.price }}</span>
  172. </template>
  173. <template slot="rebatePrice" slot-scope="{ row }">
  174. <el-input v-if="!mingxibaocun" size="small" v-model="row.rebatePrice" style="width: 100%"></el-input>
  175. <span v-else>{{ row.rebatePrice }}</span>
  176. </template>
  177. <template slot="dot" slot-scope="{ row }">
  178. <el-select
  179. v-if="!mingxibaocun && row.whether == '1'"
  180. v-model="row.dot"
  181. allow-create
  182. filterable
  183. default-first-option
  184. @focus="picihaolistfun(row.goodsId)"
  185. >
  186. <el-option v-for="(item, index) in picihaolist" :key="index" :label="item.dot" :value="item.dot"></el-option>
  187. </el-select>
  188. <span v-else>{{ row.dot }}</span>
  189. </template>
  190. <template slot="subTotalMoney" slot-scope="{ row }">{{ (row.goodsNum * row.price).toFixed(2) }}</template>
  191. <template slot="remarks" slot-scope="{ row }">
  192. <el-input v-if="!mingxibaocun" size="small" v-model="row.remarks" style="width: 100%"></el-input>
  193. <span v-else>{{ row.remarks }}</span>
  194. </template>
  195. <!-- <template slot-scope="{scope,row}" slot="goodsNum">
  196. <el-input size="small" v-model="formContacts.goodsNum" style="width: 100%">
  197. <template slot="inventory">{{ inventory }}吨</template>
  198. </el-input>
  199. </template> -->
  200. <!-- <template slot="goodsId" slot-scope="{ row, index }">
  201. <span style="display:flex">
  202. <el-select v-model="row.goodsId" placeholder="请选择" size="small" filterable
  203. style="width:60%" >
  204. <el-option v-for="item in goodsIdoptions" :key="item.id" :label="item.cname"
  205. :value="item.id">
  206. </el-option>
  207. </el-select>
  208. <el-button icon="el-icon-search" size="small" @click="rePick(row, index)"></el-button>
  209. </span>
  210. </template> -->
  211. <template slot-scope="{ type, size, row, index, disabled }" slot="menu">
  212. <el-button
  213. v-if="mingxibaocun"
  214. :size="size"
  215. :disabled="disabled || isAdd"
  216. :type="type"
  217. :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
  218. @click="hangeditBtn(row, index)"
  219. >编辑
  220. </el-button>
  221. <el-button
  222. v-else
  223. :size="size"
  224. :disabled="disabled || isAdd"
  225. :type="type"
  226. :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
  227. @click="hangbaocun(row, index)"
  228. >保存
  229. </el-button>
  230. <el-button
  231. icon="el-icon-delete"
  232. :size="size"
  233. :disabled="disabled || isDisabled"
  234. :type="type"
  235. @click="rowDelBox(row, index, 'orderItemsList')"
  236. >删除
  237. </el-button>
  238. </template>
  239. </avue-crud>
  240. </el-tab-pane>
  241. <el-tab-pane label="付款明细" name="payment_details">
  242. <avue-crud
  243. :option="optionPaymentDetails"
  244. v-model="formContacts"
  245. ref="payment_details"
  246. :data="dataList"
  247. @row-save="rowSave"
  248. @row-update="rowUpdate"
  249. @resetColumn="resetColumnTwo('payment_details', 'optionPaymentDetails', 'optionPaymentDetailsBack', 269.2)"
  250. @saveColumn="saveColumnTwo('payment_details', 'optionPaymentDetails', 'optionPaymentDetailsBack', 269.2)"
  251. >
  252. <!-- <template slot-scope="{type,size,row,index,disabled}" slot="menu">
  253. <el-button :size="size" :disabled="disabled" :type="type"
  254. :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
  255. @click="$refs.formContacts.rowCell(row, index)">{{ row.$cellEdit ? '确认' : '修改' }}
  256. </el-button>
  257. <el-button icon="el-icon-delete" :size="size" :disabled="disabled" :type="type"
  258. @click="rowDelBox(row, index, 'paymentRecordsList')">删除
  259. </el-button>
  260. </template> -->
  261. </avue-crud>
  262. </el-tab-pane>
  263. <el-tab-pane label="入库记录" name="outbound_records">
  264. <avue-crud
  265. :option="optionOutboundRecords"
  266. v-model="formContacts"
  267. ref="outbound_records"
  268. :data="form.outboundRecordsList"
  269. @row-save="rowSave"
  270. @row-update="rowUpdate"
  271. @resetColumn="resetColumnTwo('outbound_records', 'optionOutboundRecords', 'optionOutboundRecordsBack', 269.3)"
  272. @saveColumn="saveColumnTwo('outbound_records', 'optionOutboundRecords', 'optionOutboundRecordsBack', 269.3)"
  273. >
  274. <!-- <template slot-scope="{type,size,row,index,disabled}" slot="menu">
  275. <el-button :size="size" :disabled="disabled" :type="type"
  276. :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
  277. @click="$refs.formContacts.rowCell(row, index)">{{ row.$cellEdit ? '确认' : '修改' }}
  278. </el-button>
  279. <el-button icon="el-icon-delete" :size="size" :disabled="disabled" :type="type"
  280. @click="rowDelBox(row, index)">删除
  281. </el-button>
  282. </template> -->
  283. </avue-crud>
  284. </el-tab-pane>
  285. </el-tabs>
  286. </trade-card>
  287. <report-dialog :switchDialog="switchDialog" reportName="轮胎商城-采购订单" :reportId="form.id" @onClose="onClose()"></report-dialog>
  288. <el-dialog
  289. append-to-body
  290. title="审批"
  291. class="el-dialogDeep"
  292. :visible.sync="checkDialog"
  293. width="50%"
  294. :close-on-click-modal="false"
  295. :destroy-on-close="true"
  296. :close-on-press-escape="false"
  297. v-dialog-drag
  298. >
  299. <check :checkData="checkData" :checkDetail="true" :idList="[]" @operationType="operationType" @choceCheckFun="choceCheckFun"> </check>
  300. </el-dialog>
  301. <el-dialog
  302. append-to-body
  303. title="审批进度"
  304. class="el-dialogDeep"
  305. :visible.sync="checkScheduleDialog"
  306. width="40%"
  307. :close-on-click-modal="false"
  308. :destroy-on-close="true"
  309. :close-on-press-escape="false"
  310. v-dialog-drag
  311. >
  312. <check-schedule :checkId="checkId" :batchNo="batchNo" @choceScheduleFun="choceScheduleFun"></check-schedule>
  313. </el-dialog>
  314. <el-dialog title="导入明细" append-to-body :visible.sync="excelBox" v-if="excelBox" width="555px" :close-on-click-modal="false" v-dialog-drag>
  315. <avue-form :option="excelOption" v-model="excelForm" table-loading="excelLoading" :upload-before="uploadBefore" :upload-after="uploadAfter">
  316. <template slot="excelTemplate">
  317. <el-button type="primary" @click="derivation"> 点击下载<i class="el-icon-download el-icon--right"></i> </el-button>
  318. </template>
  319. </avue-form>
  320. <p style="text-align: center;color: #DC0505">
  321. 温馨提示 第一次导入时请先下载模板
  322. </p>
  323. </el-dialog>
  324. </div>
  325. <el-dialog
  326. title="选择商品"
  327. append-to-body
  328. class="el-dialogDeep"
  329. :visible.sync="dialogVisible"
  330. width="80%"
  331. :close-on-click-modal="false"
  332. :destroy-on-close="true"
  333. :close-on-press-escape="false"
  334. @close="closeGoods"
  335. >
  336. <el-row :style="{ height: rowHeight }">
  337. <el-col :span="5">
  338. <div>
  339. <el-scrollbar>
  340. <basic-container>
  341. <avue-tree style="height: 70vh;overflow-y: auto" :option="treeOption" :data="treeDataGoods" @node-click="nodeClick" />
  342. </basic-container>
  343. </el-scrollbar>
  344. </div>
  345. </el-col>
  346. <el-col :span="19">
  347. <basic-container>
  348. <avue-crud
  349. :option="optionTwo"
  350. :table-loading="loading"
  351. :data="goodsListShow"
  352. ref="crud"
  353. :search.sync="SelectSearch"
  354. @refresh-change="refreshChange"
  355. @selection-change="selectionChange"
  356. @search-change="goodsSearch"
  357. :page.sync="page"
  358. @on-load="onLoadfun"
  359. @resetColumn="resetCrud"
  360. @saveColumn="saveCrud"
  361. >
  362. <template slot="menuLeft">
  363. <el-tabs v-model="activeNameTabs" @tab-click="tabHandle">
  364. <el-tab-pane label="查询结果" name="searchList" />
  365. <el-tab-pane label="已选定数据" name="importStaging" />
  366. </el-tabs>
  367. </template>
  368. <template slot="goodsNum" slot-scope="{ row }">
  369. <el-input-number
  370. v-model="row.goodsNum"
  371. size="small"
  372. :controls="false"
  373. :precision="numberDecimal"
  374. @input="amountChange($event, row)"
  375. style="width: 100%"
  376. />
  377. </template>
  378. <template slot="dot" slot-scope="{ row }">
  379. <el-select
  380. v-if="row.whether == '1'"
  381. v-model="row.dot"
  382. allow-create
  383. filterable
  384. default-first-option
  385. @focus="picihaolistfun(row.id)"
  386. size="small"
  387. >
  388. <el-option v-for="(item, index) in picihaolist" :key="index" :label="item.dot" :value="item.dot"></el-option>
  389. </el-select>
  390. <span v-else>{{ row.dot }}</span>
  391. </template>
  392. <template slot="price" slot-scope="{ row }">
  393. <el-input-number v-model="row.price" size="small" :controls="false" style="width: 100%" />
  394. <!--<span v-else>{{ row.price }}</span>-->
  395. </template>
  396. <template slot="rebatePrice" slot-scope="{ row }">
  397. <el-input-number v-model="row.rebatePrice" size="small" :controls="false" style="width: 100%" />
  398. <!--<span v-else>{{ row.price }}</span>-->
  399. </template>
  400. <template slot-scope="scope" slot="menu">
  401. <el-button
  402. type="text"
  403. icon="el-icon-edit"
  404. size="small"
  405. @click.stop="importStagList(scope.row, scope.index)"
  406. v-if="activeNameTabs == 'searchList'"
  407. :disabled="goodsListSave.findIndex(item => item.id == scope.row.id) !== -1"
  408. >选择
  409. </el-button>
  410. <el-button type="text" icon="el-icon-delete" size="small" @click.stop="removeStagList(scope.row, scope.index)" v-else
  411. >移除
  412. </el-button>
  413. </template>
  414. </avue-crud>
  415. </basic-container>
  416. </el-col>
  417. </el-row>
  418. <span slot="footer" class="dialog-footer">
  419. <el-button @click="dialogVisible = false" :loading="saveLoading">取 消</el-button>
  420. <el-button type="primary" @click="importGoods" v-if="commodityData !== true" :loading="saveLoading">导入</el-button>
  421. <!--<el-button type="primary" @click="importChoice" v-if="commodityData === true" :loading="saveLoading"-->
  422. <!-- :disabled="tableData.length !== 1">导入</el-button>-->
  423. </span>
  424. </el-dialog>
  425. </div>
  426. </template>
  427. <script>
  428. import { getDetails as getCustom } from "@/api/tirePartsMall/basicData/customerInformation";
  429. import { getDetails as getDetailsLT } from "@/api/tirePartsMall/basicData/commodityInformation/index";
  430. import { dateFormat } from "@/util/date";
  431. import { getToken } from "@/util/auth";
  432. import {
  433. getDetails,
  434. submit,
  435. generateShipTask,
  436. tradingBox,
  437. delOrderItem,
  438. checkOrder,
  439. confirmRefund,
  440. goodsListXs,
  441. inboundTask,
  442. checkOrderCG,
  443. revokeCheckOrderCG,
  444. revokeInboundTask,
  445. goodsListAll,
  446. shortcutWarehousing,
  447. selectShipItemRecord
  448. } from "@/api/tirePartsMall/salesManagement/saleOrder";
  449. import { dotList, goodsDetail } from "@/api/tirePartsMall/purchasingManagement/warehouseEntryOrder";
  450. import reportDialog from "@/components/report-dialog/main";
  451. import checkSchedule from "@/components/checkL/checkSchedule";
  452. // import check from "@/components/checkL/check";
  453. import check from "../../../approveDataL/check.vue";
  454. import { getCorpType, getList } from "@/api/tirePartsMall/basicData/commodityInformation";
  455. import { isProcurement } from "@/api/basicData/configuration";
  456. import commodity from "../../configuration/commodity.json";
  457. export default {
  458. name: "detailsPage",
  459. data() {
  460. return {
  461. numberDecimal: 0,
  462. SelectSearch: {},
  463. // 编辑还是保存
  464. mingxibaocun: true,
  465. // 批次号请求到的数据
  466. picihaolist: [],
  467. // 添加商品弹窗
  468. dialogVisible: false,
  469. // 弹窗高度
  470. rowHeight: "",
  471. areaData: [],
  472. areaOption: {
  473. header: false,
  474. menu: false,
  475. column: [
  476. {
  477. label: "库区",
  478. prop: "reservoirAreaName",
  479. overHidden: true
  480. },
  481. {
  482. label: "批次号",
  483. prop: "dot",
  484. overHidden: true
  485. },
  486. {
  487. label: "数量",
  488. prop: "quantity",
  489. overHidden: true
  490. }
  491. ]
  492. },
  493. // 左侧选择搜索
  494. treeDataGoods: [],
  495. treeDeptId: "",
  496. page: {
  497. pageSize: 10,
  498. currentPage: 1,
  499. total: 0,
  500. pageSizes: [10, 50, 100, 300, 500]
  501. },
  502. pageList: {
  503. pageSize: 10,
  504. currentPage: 1,
  505. total: 0
  506. },
  507. // 左侧选择
  508. treeOption: {
  509. addBtn: false,
  510. menu: false,
  511. size: "small",
  512. props: {
  513. labelText: "标题",
  514. label: "title",
  515. value: "value"
  516. }
  517. },
  518. // 表格需要的配置
  519. optionTwo: commodity,
  520. loading: false,
  521. // 商品列表数据合计
  522. goodsListShow: [],
  523. // 商品列表暂存
  524. goodsListSave: [],
  525. saveLoading: false,
  526. commodityData: false,
  527. surplusRouteQuantityOption: [],
  528. tableData: [],
  529. // tabs切换
  530. activeNameTabs: "searchList",
  531. data: [],
  532. inventory: 0,
  533. isStatus: 1,
  534. excelBox: false,
  535. // 商品名称
  536. goodsIdoptions: [],
  537. dataList: [],
  538. dicUrlWithCustomId: "",
  539. sharedCompanyId: 0,
  540. isAddBtn: true,
  541. viewDisabled: false, // 请核和大审批按钮是否禁用
  542. isApplySettlement: false, // 请核数据按钮是否禁用
  543. isRevocationRequest: true, // 撤销审核
  544. isExamineBtn: true, // 审批
  545. isAdd: false,
  546. editButton: true, // 编辑按钮和保存按钮的显示隐藏
  547. isSaveBtn: false, // 保存的禁用
  548. isDisabledTask: false, // 生成,撤销任务按钮是否禁用
  549. buttonText: "生成任务",
  550. buttonColor: "success", // 初始颜色为success
  551. isContacts: false, // 基础信息插槽禁用
  552. goods: [],
  553. isDisabled: false,
  554. //地址
  555. recAddressOption: [],
  556. contactsOption: [],
  557. checkData: {},
  558. checkScheduleDialog: false,
  559. isConfirmRefundBtn: true,
  560. checkDialog: false,
  561. checkId: "",
  562. batchNo: "",
  563. switchDialog: false,
  564. activeName: "sale_detail",
  565. disabled: false,
  566. key: 0,
  567. excelOption: {
  568. submitBtn: false,
  569. emptyBtn: false,
  570. column: [
  571. {
  572. label: "模板下载",
  573. prop: "excelTemplate",
  574. formslot: true,
  575. span: 24
  576. },
  577. {
  578. label: "导入明细",
  579. prop: "excelFile",
  580. type: "upload",
  581. drag: true,
  582. loadText: "上传中,请稍等",
  583. accept: ".xls,.xlsx",
  584. span: 24,
  585. propsHttp: {
  586. res: "data"
  587. },
  588. tip: "请上传 .xls,.xlsx 标准格式文件",
  589. action: "/api/blade-sales-part/ship/import-item"
  590. }
  591. ]
  592. },
  593. templateUrl: "/api/blade-sales-part/ship/export-item", // 模板url
  594. form: {
  595. orderItemsList: [],
  596. paymentRecordsList: [],
  597. outboundRecordsList: []
  598. },
  599. optionForm: {
  600. menuBtn: false,
  601. span: 8,
  602. disabled: false,
  603. column: [
  604. {
  605. label: "供应商",
  606. prop: "customerId",
  607. disabled: false,
  608. remote: true,
  609. type: "select",
  610. props: {
  611. label: "cname",
  612. value: "id"
  613. },
  614. cascader: ["recAddress"],
  615. click: () => {
  616. this.$refs.form.dicInit();
  617. },
  618. change: data => {
  619. if (!this.onLoad.id) {
  620. // this.$set(this.optionContactsBack, "addBtn", true)
  621. // this['optionContacts'] = this['optionContactsBack'];
  622. // this.delColumnData(this.getColumnName('269.1'), this['optionContactsBack']);
  623. }
  624. if (this.$refs.form.DIC.customerId || !this.onLoad.id) {
  625. getCustom({ id: data.value }).then(res => {
  626. this.dicUrlWithCustomId = res.data.data.id ? res.data.data.id : "";
  627. // this.form.storageId ? this.form.storageId : res.data.data.deliveryWarehouseId
  628. // this.form.storageId = res.data.data.deliveryWarehouseId
  629. this.form.storageId = this.form.storageId ? this.form.storageId : res.data.data.deliveryWarehouseId;
  630. this.form.contacts = res.data.data.corpsAttnList[0].cname;
  631. this.form.phone = res.data.data.corpsAttnList[0].tel;
  632. //联系人
  633. this.contactsOption = res.data.data.corpsAttnList;
  634. //地址
  635. this.recAddressOption = res.data.data.corpsAddrList;
  636. console.log("contactsOption", this.contactsOption);
  637. this.form.recAddress = res.data.data.corpsAddrList[0].belongtoarea + res.data.data.corpsAddrList[0].detailedAddress;
  638. });
  639. }
  640. // if (this.$refs.form.DIC.customerId || data.value) {
  641. // for (let item of this.$refs.form.DIC.customerId) {
  642. // if (item.id == data.value) {
  643. // console.log(data);
  644. // console.log(this.$refs.form);
  645. // console.log(item);
  646. // // 后端返回数据暂无联系人、地址等数据,无法下拉默认
  647. // this.form.phone = item.tel
  648. // }
  649. // }
  650. // }
  651. },
  652. dicUrl: "/api/blade-sales-part/corpsDesc/listAll?cname={{key}}&corpType=GYS&enableOrNot=1",
  653. rules: [
  654. {
  655. required: true,
  656. message: " ",
  657. trigger: "blur"
  658. }
  659. ]
  660. },
  661. {
  662. label: "仓库",
  663. prop: "storageId",
  664. type: "select",
  665. disabled: false,
  666. // placeholder: '仓库为空即为异地销售',
  667. props: {
  668. label: "cname",
  669. value: "id"
  670. },
  671. dicUrl: "/api/blade-sales-part/storageDesc/listAll",
  672. rules: [
  673. {
  674. required: true,
  675. message: " ",
  676. trigger: "blur"
  677. }
  678. ]
  679. },
  680. // {
  681. // label: '来源单号',
  682. // prop: "srcOrdNo",
  683. // disabled: true
  684. // }, {
  685. // label: '业务来源',
  686. // prop: "businessSource",
  687. // disabled: true
  688. // },
  689. {
  690. label: "业务日期",
  691. prop: "businesDate",
  692. searchProp: "businesDateList",
  693. disabled: false,
  694. type: "datetime",
  695. value: dateFormat(new Date(), "yyyy-MM-dd"),
  696. format: "yyyy-MM-dd",
  697. valueFormat: "yyyy-MM-dd",
  698. rules: [
  699. {
  700. required: true,
  701. message: "",
  702. trigger: "blur"
  703. }
  704. ]
  705. },
  706. {
  707. label: "联系人",
  708. type: "select",
  709. prop: "contacts",
  710. disabled: false,
  711. allowCreate: true,
  712. filterable: true,
  713. props: {
  714. label: "address",
  715. value: "id"
  716. },
  717. dicUrl: "/api/blade-sales-part/corpsAddr/corpIdByAddr?pid={{key}}"
  718. },
  719. {
  720. label: "电话",
  721. disabled: false,
  722. prop: "phone"
  723. },
  724. {
  725. label: "地址",
  726. prop: "recAddress",
  727. type: "select",
  728. allowCreate: true,
  729. filterable: true,
  730. disabled: false,
  731. props: {
  732. label: "address",
  733. value: "address"
  734. },
  735. dicUrl: "/api/blade-sales-part/corpsAddr/corpIdByAddr?pid={{key}}"
  736. },
  737. // {
  738. // label: '配送方式',
  739. // type: 'select',
  740. // prop: "shipType",
  741. // disabled: false,
  742. // dicUrl: "/api/blade-system/dict-biz/dictionary?code=deliveryMethod",
  743. // props: {
  744. // label: "dictValue",
  745. // value: "dictValue"
  746. // },
  747. // value: '物流'
  748. // }, {
  749. // label: '物流公司',
  750. // disabled: false,
  751. // prop: "logisticsCorpName"
  752. // },
  753. // {
  754. // label: '成本',
  755. // prop: "cost",
  756. // display: true,
  757. // disabled: true
  758. // }, {
  759. // label: '毛利',
  760. // prop: "grossProfit",
  761. // disabled: true
  762. // },
  763. // {
  764. // label: '采购金额',
  765. // prop: "salesAmount",
  766. // disabled: true
  767. // },
  768. // {
  769. // label: '运费',
  770. // prop: "freight",
  771. // disabled: true
  772. // },
  773. {
  774. label: "应付类别",
  775. prop: "receivableType",
  776. type: "select",
  777. disabled: false,
  778. dicUrl: "/api/blade-system/dict-biz/dictionary?code=receivableType",
  779. props: {
  780. label: "dictValue",
  781. value: "dictValue"
  782. },
  783. value: "网络支付"
  784. },
  785. {
  786. label: "总金额",
  787. prop: "totalMoney",
  788. disabled: true
  789. },
  790. {
  791. label: "已付金额",
  792. prop: "paymentAmountTl",
  793. disabled: true
  794. },
  795. {
  796. label: "单据编号",
  797. prop: "ordNo",
  798. disabled: true
  799. },
  800. {
  801. label: "退货数量",
  802. prop: "returnsNumber",
  803. disabled: true
  804. },
  805. {
  806. label: "退货金额",
  807. prop: "returnsAmount",
  808. disabled: true
  809. },
  810. {
  811. label: "备注",
  812. prop: "remarks",
  813. type: "textarea",
  814. disabled: false,
  815. span: 16,
  816. minRows: 1
  817. }
  818. ]
  819. },
  820. formContacts: {},
  821. optionContacts: {},
  822. optionContactsBack: {
  823. disabled: false,
  824. border: true,
  825. align: "center",
  826. index: true,
  827. addBtnText: "添加商品",
  828. updateBtnText: "保存",
  829. refreshBtn: false,
  830. dialogDrag: true,
  831. addBtn: false,
  832. span: 8,
  833. height: 500,
  834. // 添加
  835. addRowBtn: false,
  836. // 保存按钮
  837. editBtn: false,
  838. // 航编辑开启
  839. cellBtn: true,
  840. rowKey: "ids",
  841. delBtn: false,
  842. menuWidth: 140,
  843. dialogTop: 25,
  844. dialogWidth: "80%",
  845. summaryText: this.$t("land118n.total"),
  846. showSummary: true,
  847. selection: true,
  848. sumColumnList: [
  849. {
  850. name: "goodsNum",
  851. type: "sum"
  852. },
  853. {
  854. name: "price",
  855. type: "sum",
  856. decimals: 2
  857. },
  858. {
  859. name: "sendNum",
  860. type: "sum",
  861. decimals: 2
  862. },
  863. {
  864. name: "subTotalMoney",
  865. type: "sum",
  866. decimals: 2
  867. },
  868. {
  869. name: "returnsNumber",
  870. type: "sum"
  871. },
  872. {
  873. name: "returnsAmount",
  874. type: "sum"
  875. }
  876. ],
  877. column: [
  878. {
  879. label: "商品名称",
  880. prop: "goodsId",
  881. width: 200,
  882. disabled: false,
  883. remote: true,
  884. hide: true,
  885. overHidden: true,
  886. type: "select",
  887. // dicData: [],
  888. props: {
  889. label: "cname",
  890. value: "id"
  891. },
  892. // dicUrl: '/api/blade-sales-part/goodsDesc/goodsListAll?cname={{key}}'
  893. dicUrl: "/api/blade-sales-part/goodsDesc/list?current=1&size=10&cname={{key}}&enableOrNot=1"
  894. // dicUrl: "/api/blade-sales-part/goodsDesc/goodsListXs?cname={{key}}"
  895. },
  896. {
  897. label: "商品名称",
  898. prop: "goodsName",
  899. width: 200,
  900. disabled: false,
  901. remote: true,
  902. overHidden: true
  903. },
  904. {
  905. label: "数量",
  906. prop: "goodsNum",
  907. overHidden: true,
  908. disabled: false,
  909. cell: true,
  910. width: 100,
  911. rules: [
  912. {
  913. required: true,
  914. message: " ",
  915. trigger: "blur"
  916. },
  917. {
  918. validator: (rule, value, callback) => {
  919. console.log(this.formContacts.inventory);
  920. if (value < 0) {
  921. callback(new Error("数量不能小于0"));
  922. } else {
  923. callback();
  924. }
  925. },
  926. trigger: "blur"
  927. }
  928. ]
  929. },
  930. {
  931. label: "价格",
  932. prop: "price",
  933. overHidden: true,
  934. width: 100,
  935. disabled: false,
  936. cell: true,
  937. rules: [
  938. {
  939. required: true,
  940. message: " ",
  941. trigger: "blur"
  942. },
  943. {
  944. validator: (rule, value, callback) => {
  945. if (value < 0) {
  946. callback(new Error("价格不能小于0"));
  947. } else {
  948. callback();
  949. }
  950. },
  951. trigger: "blur"
  952. }
  953. ]
  954. },
  955. {
  956. label: "库存",
  957. prop: "inventory",
  958. overHidden: true,
  959. width: 100
  960. },
  961. {
  962. label: "批次号",
  963. prop: "dot",
  964. cell: true,
  965. width: 120,
  966. type: "select",
  967. disabled: true,
  968. allowCreate: true,
  969. filterable: true,
  970. dicData: [],
  971. props: {
  972. label: "dot",
  973. value: "dot"
  974. },
  975. dicUrl: "/api/blade-sales-part/stockDesc/dotList",
  976. overHidden: true
  977. },
  978. {
  979. label: "小计",
  980. prop: "subTotalMoney",
  981. overHidden: true,
  982. width: 100,
  983. disabled: true,
  984. editDisplay: false,
  985. addDisplay: false
  986. },
  987. {
  988. label: "商品编码",
  989. prop: "goodsNo",
  990. overHidden: true,
  991. disabled: false,
  992. width: 100
  993. },
  994. {
  995. label: "品牌",
  996. prop: "brandName",
  997. disabled: false,
  998. width: 100,
  999. overHidden: true
  1000. },
  1001. {
  1002. label: "规格型号",
  1003. prop: "propertyName",
  1004. overHidden: true,
  1005. disabled: false,
  1006. width: 100
  1007. },
  1008. {
  1009. label: "花纹",
  1010. prop: "pattern",
  1011. overHidden: true,
  1012. disabled: false,
  1013. width: 100
  1014. },
  1015. {
  1016. label: "商品描述",
  1017. prop: "goodsDescription",
  1018. disabled: false,
  1019. overHidden: true,
  1020. width: 100
  1021. },
  1022. {
  1023. label: "单位",
  1024. prop: "units",
  1025. type: "select",
  1026. disabled: false,
  1027. props: {
  1028. label: "dictValue",
  1029. value: "dictValue"
  1030. },
  1031. dicUrl: "/api/blade-system/dict-biz/dictionary?code=unit",
  1032. overHidden: true,
  1033. width: 100
  1034. },
  1035. {
  1036. label: "收货数量",
  1037. prop: "sendNum",
  1038. overHidden: true,
  1039. width: 100,
  1040. disabled: true,
  1041. editDisplay: false,
  1042. addDisplay: false
  1043. },
  1044. {
  1045. label: "返利后单价",
  1046. prop: "rebatePrice",
  1047. overHidden: true,
  1048. width: 100,
  1049. cell: true
  1050. },
  1051. {
  1052. label: "返利后成本价",
  1053. prop: "rebateCostprie",
  1054. overHidden: true,
  1055. width: 100,
  1056. disabled: true,
  1057. editDisplay: false,
  1058. addDisplay: false
  1059. },
  1060. {
  1061. label: "返利后利润",
  1062. prop: "rebateProfit",
  1063. overHidden: true,
  1064. width: 100,
  1065. disabled: true,
  1066. editDisplay: false,
  1067. addDisplay: false
  1068. },
  1069. {
  1070. label: "退货数量",
  1071. prop: "returnsNumber",
  1072. overHidden: true,
  1073. width: 100,
  1074. disabled: true
  1075. },
  1076. {
  1077. label: "退货金额",
  1078. prop: "returnsAmount",
  1079. overHidden: true,
  1080. width: 100,
  1081. disabled: true
  1082. },
  1083. // {
  1084. // label: '利润',
  1085. // prop: 'profit',
  1086. // overHidden: true,
  1087. // width: 100
  1088. // },
  1089. // {
  1090. // label: '返利',
  1091. // prop: 'thisAmount',
  1092. // overHidden: true,
  1093. // width: 100
  1094. // },
  1095. // {
  1096. // label: '成本',
  1097. // prop: 'costprie',
  1098. // overHidden: true,
  1099. // width: 100,
  1100. // disabled: true,
  1101. // editDisplay: false,
  1102. // addDisplay: false
  1103. // },
  1104. // {
  1105. // label: '毛利',
  1106. // prop: 'grossProfit',
  1107. // overHidden: true,
  1108. // width: 100,
  1109. // disabled: true,
  1110. // editDisplay: false,
  1111. // addDisplay: false
  1112. // },
  1113. {
  1114. label: "备注",
  1115. prop: "remarks",
  1116. overHidden: true,
  1117. width: 100,
  1118. disabled: false
  1119. }
  1120. ]
  1121. },
  1122. selectionMultilist: [], // 多选数据
  1123. optionPaymentDetails: {},
  1124. optionPaymentDetailsBack: {
  1125. align: "center",
  1126. index: true,
  1127. addBtnText: "录入明细",
  1128. menu: false,
  1129. refreshBtn: false,
  1130. dialogDrag: true,
  1131. addBtn: false,
  1132. span: 8,
  1133. height: 600,
  1134. addRowBtn: false,
  1135. editBtn: false,
  1136. delBtn: false,
  1137. menuWidth: 140,
  1138. dialogTop: 25,
  1139. dialogWidth: "80%",
  1140. column: [
  1141. {
  1142. label: "支付编号",
  1143. prop: "serialNumber"
  1144. },
  1145. {
  1146. label: "金额",
  1147. prop: "amount"
  1148. },
  1149. {
  1150. label: "类型",
  1151. prop: "type"
  1152. },
  1153. {
  1154. label: "支付时间",
  1155. prop: "createTime"
  1156. }
  1157. ]
  1158. },
  1159. optionOutboundRecords: {},
  1160. optionOutboundRecordsBack: {
  1161. align: "center",
  1162. index: true,
  1163. menu: false,
  1164. addBtnText: "录入明细",
  1165. refreshBtn: false,
  1166. dialogDrag: true,
  1167. addBtn: false,
  1168. span: 8,
  1169. height: 600,
  1170. addRowBtn: false,
  1171. editBtn: false,
  1172. delBtn: false,
  1173. // menuWidth: 140,
  1174. dialogTop: 25,
  1175. dialogWidth: "80%",
  1176. column: [
  1177. {
  1178. label: "入库单号",
  1179. prop: "billno"
  1180. },
  1181. // {
  1182. // label: '来源单号',
  1183. // prop: 'ordNo'
  1184. // },
  1185. {
  1186. label: "数量",
  1187. prop: "goodsTotalNum"
  1188. },
  1189. {
  1190. label: "实际数量",
  1191. prop: "sendTotalNum"
  1192. },
  1193. {
  1194. label: "业务类型",
  1195. prop: "bizTypeName"
  1196. },
  1197. {
  1198. label: "状态",
  1199. prop: "statusName"
  1200. },
  1201. {
  1202. label: "业务时间",
  1203. prop: "createTime"
  1204. }
  1205. ]
  1206. }
  1207. };
  1208. },
  1209. components: { reportDialog, check, checkSchedule },
  1210. props: {
  1211. onLoad: Object,
  1212. detailData: Object
  1213. },
  1214. async created() {
  1215. this.findObject(this.optionContactsBack.column, "goodsId").click = ({ value, column }) => {
  1216. this.$refs.formContacts.dicInit();
  1217. };
  1218. this.findObject(this.optionContactsBack.column, "goodsId").change = ({ value, column }) => {
  1219. if (this.formContacts.goodsId !== value) {
  1220. goodsDetail({ id: value, customId: this.dicUrlWithCustomId, stock: this.form.storageId ? this.form.storageId : "" }).then(res => {
  1221. this.goods = res.data.data;
  1222. this.formContacts.goodsNo = res.data.data.code;
  1223. this.formContacts.brandId = res.data.data.brandId;
  1224. this.formContacts.inventory = res.data.data.inventory;
  1225. // this.formContacts.brandId = res.data.data.brandName
  1226. // this.formContacts.brandName = res.data.data.brandId
  1227. this.formContacts.propertyName = res.data.data.specificationAndModel;
  1228. this.formContacts.pattern = res.data.data.brandItem;
  1229. this.formContacts.goodsDescription = res.data.data.goodsDescription;
  1230. this.formContacts.units = res.data.data.unit;
  1231. this.formContacts.price = res.data.data.price;
  1232. //
  1233. this.formContacts.sharedCompanyId = res.data.data.sharedCompanyId;
  1234. console.log(res.data.data.sharedCompanyId);
  1235. console.log(res.data.data.sharedCompanyName);
  1236. this.form.sharedCompanyId = res.data.data.sharedCompanyId;
  1237. this.form.sharedCompanyName = res.data.data.sharedCompanyName;
  1238. this.sharedCompanyId = res.data.data.sharedCompanyId;
  1239. console.log(res.data.data.sharedCompanyId);
  1240. console.log(this.form.orderItemsList);
  1241. for (let i = 0; i < this.form.orderItemsList.length; i++) {
  1242. console.log(Number(this.form.orderItemsList[i].sharedCompanyId));
  1243. if (Number(this.form.orderItemsList[i].sharedCompanyId) != Number(res.data.data.sharedCompanyId)) {
  1244. this.isStatus = 0;
  1245. }
  1246. }
  1247. if (res.data.data.whether == 0) {
  1248. this.findObject(this.optionContactsBack.column, "dot").disabled = true;
  1249. } else {
  1250. this.findObject(this.optionContactsBack.column, "dot").disabled = false;
  1251. dotList({
  1252. storageId: this.form.storageId,
  1253. goodsId: this.formContacts.goodsId
  1254. }).then(res => {
  1255. this.findObject(this.optionContactsBack.column, "dot").dicData = res.data.data;
  1256. });
  1257. }
  1258. // this.formContacts.goodsId = res.data.data.cname
  1259. // this.formContacts.goodsName = res.data.data.id
  1260. });
  1261. }
  1262. };
  1263. this.optionContacts = await this.getColumnData(this.getColumnName(269.1), this.optionContactsBack);
  1264. isProcurement({ param: "whether.model" }).then(res => {
  1265. if (res.data.data == 1) {
  1266. this.findObject(this.optionContacts.column, "pattern").label = "规格型号1";
  1267. this.findObject(this.optionTwo.column, "brandItem").label = "规格型号1";
  1268. this.findObject(this.optionTwo.column, "originalFactory").search = false;
  1269. this.findObject(this.optionTwo.column, "explosionProof").search = false;
  1270. this.findObject(this.optionTwo.column, "selfRecovery").search = false;
  1271. this.findObject(this.optionTwo.column, "explosionProof").hide = true;
  1272. this.findObject(this.optionTwo.column, "originalFactory").hide = true;
  1273. this.findObject(this.optionTwo.column, "selfRecovery").hide = true;
  1274. this.findObject(this.optionTwo.column, "explosionProof").showColumn = false;
  1275. this.findObject(this.optionTwo.column, "originalFactory").showColumn = false;
  1276. this.findObject(this.optionTwo.column, "selfRecovery").showColumn = false;
  1277. }
  1278. });
  1279. this.findObject(this.optionContacts.column, "goodsId").change = ({ value, column }) => {
  1280. if (this.formContacts.goodsId !== value) {
  1281. goodsDetail({ id: value, customId: this.dicUrlWithCustomId, stock: this.form.storageId ? this.form.storageId : "" }).then(res => {
  1282. this.goods = res.data.data;
  1283. this.formContacts.goodsNo = res.data.data.code;
  1284. this.formContacts.brandId = res.data.data.brandId;
  1285. this.formContacts.inventory = res.data.data.inventory;
  1286. // this.formContacts.brandId = res.data.data.brandName
  1287. // this.formContacts.brandName = res.data.data.brandId
  1288. this.formContacts.propertyName = res.data.data.specificationAndModel;
  1289. this.formContacts.pattern = res.data.data.brandItem;
  1290. this.formContacts.goodsDescription = res.data.data.goodsDescription;
  1291. this.formContacts.units = res.data.data.unit;
  1292. this.sharedCompanyId = res.data.data.sharedCompanyId;
  1293. this.formContacts.sharedCompanyId = res.data.data.sharedCompanyId;
  1294. //
  1295. this.form.sharedCompanyId = res.data.data.sharedCompanyId;
  1296. this.form.sharedCompanyName = res.data.data.sharedCompanyName;
  1297. for (let i = 0; i < this.form.orderItemsList.length; i++) {
  1298. if (this.form.orderItemsList[i].sharedCompanyId != res.data.data.sharedCompanyId) {
  1299. this.isStatus = 0;
  1300. }
  1301. }
  1302. if (res.data.data.whether == 0) {
  1303. this.findObject(this.optionContacts.column, "dot").disabled = true;
  1304. } else {
  1305. this.findObject(this.optionContacts.column, "dot").disabled = false;
  1306. dotList({
  1307. storageId: this.form.storageId,
  1308. goodsId: this.formContacts.goodsId
  1309. }).then(res => {
  1310. this.findObject(this.optionContacts.column, "dot").dicData = res.data.data;
  1311. });
  1312. }
  1313. // this.formContacts.goodsId = res.data.data.cname
  1314. // this.formContacts.goodsName = res.data.data.id
  1315. });
  1316. }
  1317. };
  1318. this.optionPaymentDetails = await this.getColumnData(this.getColumnName(269.2), this.optionPaymentDetailsBack);
  1319. this.optionOutboundRecords = await this.getColumnData(this.getColumnName(269.3), this.optionOutboundRecordsBack);
  1320. this.key++;
  1321. if (this.onLoad.id && this.detailData.id) {
  1322. this.$set(this.optionForm, "disabled", true);
  1323. this.$set(this.optionContactsBack, "disabled", true);
  1324. this.isContacts = true;
  1325. this.isDisabled = true;
  1326. //添加删除按钮禁用
  1327. this.isAdd = true;
  1328. this.refresh(this.onLoad.id, true);
  1329. } else if (this.onLoad.id) {
  1330. this.refresh(this.onLoad.id, true);
  1331. }
  1332. // 由 from 改为 onLoad
  1333. if (!this.onLoad.id) {
  1334. this.editButton = false; // 第一次录入显示保存按钮
  1335. this.optionContactsBack.column.forEach(its => {
  1336. if (its.prop == "goodsId" || its.prop == "goodsNum" || its.prop == "price" || its.prop == "dot" || its.prop == "remarks") {
  1337. its.disabled = false;
  1338. } else {
  1339. its.disabled = true;
  1340. }
  1341. });
  1342. this.isDisabledTask = true;
  1343. // this.$set(this.optionContactsBack, "addBtn", false)
  1344. // this['optionContacts'] = this['optionContactsBack'];
  1345. // this.delColumnData(this.getColumnName('269.1'), this['optionContactsBack']);
  1346. }
  1347. if (!this.detailData.id) {
  1348. this.isAddBtn = false;
  1349. this.isDisabledTask = false;
  1350. this.form.businessSource = "内部销售";
  1351. }
  1352. if (this.detailData.check) {
  1353. console.log("this.detailData.check", this.detailData.check);
  1354. this.isExamineBtn = false;
  1355. // this.batchNo = this.detailData.check.batchNo
  1356. }
  1357. // if (this.detailData.id) {
  1358. // this.getDetailsfun()
  1359. // }
  1360. isProcurement({ param: "number.decimal" }).then(res => {
  1361. this.numberDecimal = res.data.data ? Number(res.data.data) : 0;
  1362. });
  1363. },
  1364. watch: {
  1365. "form.sharedCompanyId"(newSharedCompanyId, oldSharedCompanyId) {
  1366. console.log(newSharedCompanyId, oldSharedCompanyId);
  1367. if (newSharedCompanyId != oldSharedCompanyId) {
  1368. console.log("不能添加");
  1369. }
  1370. console.log(this.sharedCompanyId);
  1371. },
  1372. $route(to, from) {
  1373. if (this.onLoad.id && this.detailData.id) {
  1374. this.$set(this.optionForm, "disabled", true);
  1375. this.$set(this.optionContactsBack, "disabled", true);
  1376. this.isContacts = true;
  1377. this.isDisabled = true;
  1378. this.isAdd = true;
  1379. this.refresh(this.onLoad.id, true);
  1380. } else if (this.onLoad.id) {
  1381. console.log(2);
  1382. this.refresh(this.onLoad.id, true);
  1383. }
  1384. // if (!this.form.id) {
  1385. // console.log(3);
  1386. // // this.$set(this.optionContactsBack, "addBtn", false)
  1387. // this['optionContacts'] = this['optionContactsBack'];
  1388. // this.delColumnData(this.getColumnName('269.1'), this['optionContactsBack']);
  1389. // }
  1390. // if (!this.detailData.id) {
  1391. // this.form.businessSource = '内部销售'
  1392. // }
  1393. if (this.detailData.status == 1) {
  1394. this.isExamineBtn = false;
  1395. }
  1396. // if (to.name == '销售订单') {
  1397. // console.log('销售订单');
  1398. // this.isExamineBtn = false;
  1399. // }
  1400. }
  1401. },
  1402. mounted() {
  1403. this.$nextTick(() => {
  1404. // 监听浏览器高度变化,改变表格高度
  1405. window.onresize = () => {
  1406. this.rowHeight = window.innerHeight - 130 + "px";
  1407. };
  1408. });
  1409. },
  1410. methods: {
  1411. viewArea(row) {
  1412. this.areaData = [];
  1413. selectShipItemRecord({
  1414. shipItemId: row.id
  1415. }).then(res => {
  1416. this.areaData = res.data.data;
  1417. });
  1418. },
  1419. rowSum(row) {
  1420. row.subTotalMoney = row.goodsNum * row.price;
  1421. return row.subTotalMoney;
  1422. },
  1423. //生成退货单
  1424. getReturns() {
  1425. this.$confirm("您确定要退货吗?", {
  1426. confirmButtonText: "确定",
  1427. cancelButtonText: "取消",
  1428. type: "warning"
  1429. }).then(() => {
  1430. this.$router.push({
  1431. path: "/tirePartsMall/purchaseService/returns/index",
  1432. query: {
  1433. bsType: "TKCG",
  1434. id: this.form.id
  1435. }
  1436. });
  1437. });
  1438. },
  1439. // 一键入库
  1440. oneClickStorage() {
  1441. if (this.form.orderItemsList.length == 0) {
  1442. this.$message.warning("请先添加采购明细");
  1443. return;
  1444. }
  1445. // 计算合计用于展示
  1446. let goodsNumhe = 0;
  1447. let subTotalMoneyhe = 0;
  1448. for (let item of this.form.orderItemsList) {
  1449. goodsNumhe += Number(item.goodsNum);
  1450. subTotalMoneyhe += Number(item.subTotalMoney);
  1451. }
  1452. this.$alert(
  1453. `<div style="text-align: center"><span style="color: #d85542">一件采购入库不可撤销,请确认无误在操作</span><br><span>本次入库金额:${subTotalMoneyhe.toFixed(
  1454. 2
  1455. )}</span><br><span>本次入库数量:${goodsNumhe}</span><br><span>是否要一件采购入库?</span></div>`,
  1456. "提示",
  1457. {
  1458. dangerouslyUseHTMLString: true
  1459. }
  1460. ).then(() => {
  1461. const loading = this.$loading({
  1462. lock: true,
  1463. text: "加载中",
  1464. spinner: "el-icon-loading",
  1465. background: "rgba(255,255,255,0.7)"
  1466. });
  1467. shortcutWarehousing(this.form)
  1468. .then(res => {
  1469. this.$message.success("保存成功");
  1470. this.isAddBtn = true; // 表格的添加商品禁用
  1471. this.refresh(res.data.data.id);
  1472. loading.close();
  1473. })
  1474. .catch(() => {
  1475. loading.close();
  1476. });
  1477. });
  1478. },
  1479. // 获取明细信息
  1480. getDetailsfun() {
  1481. getDetails({
  1482. id: this.detailData.id
  1483. }).then(res => {
  1484. this.form = res.data.data;
  1485. this.form.orderItemsList = res.data.data.orderItemsList;
  1486. this.editButton = true; //显示编辑按钮
  1487. });
  1488. },
  1489. // 获取左侧筛选
  1490. getAllWorkDicts() {
  1491. getCorpType({ corpType: "SP", whetherIntegral: "0" }).then(res => {
  1492. this.treeDataGoods = res.data.data;
  1493. });
  1494. },
  1495. //导入页左商品类型查询
  1496. nodeClick(data) {
  1497. this.treeDeptId = data.id;
  1498. this.page.currentPage = 1;
  1499. this.onLoadfun(this.page, { ...this.SelectSearch, goodsTypeId: this.treeDeptId });
  1500. },
  1501. closeGoods() {
  1502. this.treeDataGoods = [];
  1503. this.treeDeptId = "";
  1504. this.activeNameTabs = "searchList";
  1505. },
  1506. //刷新触发
  1507. refreshChange() {
  1508. this.page.currentPage = 1;
  1509. this.onLoadfun(this.page);
  1510. },
  1511. // 这个方法是解决 this.onLoad is not a function 的问题
  1512. onaloadfun(page, params = { artsVision: this.form.belongToCorpId }) {
  1513. this.loading = true;
  1514. getList({
  1515. ...params,
  1516. current: page.currentPage,
  1517. size: page.pageSize,
  1518. whetherIntegral: "0"
  1519. }).then(res => {
  1520. console.log(res, 1213);
  1521. const data = res.data.data;
  1522. this.page.total = data.total;
  1523. this.pageList.total = data.total;
  1524. this.data = data.records;
  1525. this.goodsListShow = data.records;
  1526. this.loading = false;
  1527. });
  1528. // getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId, null).then(res => {
  1529. // const data = res.data.data;
  1530. // this.page.total = data.total;
  1531. // this.pageList.total = data.total
  1532. // this.data = data.records;
  1533. // this.goodsListShow = data.records;
  1534. // this.loading = false;
  1535. // });
  1536. },
  1537. //选中触发
  1538. selectionChange(list) {
  1539. this.tableData = list;
  1540. },
  1541. // 点击搜索触发
  1542. goodsSearch(params, done) {
  1543. this.page.currentPage = 1;
  1544. params = {
  1545. ...params,
  1546. artsVision: this.form.belongToCorpId
  1547. };
  1548. this.onLoadfun(this.page, params);
  1549. done();
  1550. },
  1551. // 标签页切换
  1552. tabHandle(data) {
  1553. if (data.name == "searchList") {
  1554. this.goodsListShow = this.data;
  1555. this.page.total = this.pageList.total;
  1556. } else if (data.name == "importStaging") {
  1557. this.goodsListShow = this.goodsListSave;
  1558. this.page.total = 0;
  1559. }
  1560. },
  1561. // 商品信息价格计算
  1562. amountChange(value, row) {
  1563. if (value > 0) {
  1564. this.$refs.crud.toggleRowSelection(row, true);
  1565. } else {
  1566. this.$refs.crud.toggleRowSelection(row, false);
  1567. }
  1568. // 价格
  1569. // if (!row.price) {
  1570. // row.price = 0;
  1571. // }
  1572. },
  1573. importStagList(row, index, type) {
  1574. this.goodsListSave.push(row);
  1575. },
  1576. removeStagList(row, index, type) {
  1577. this.goodsListSave.splice(row.$index, 1);
  1578. },
  1579. //确认导入触发
  1580. async importGoods() {
  1581. this.surplusRouteQuantityOption.push({ storageQuantity: "0" });
  1582. if (this.goodsListSave.length > 0) {
  1583. this.goodsListSaveHandle();
  1584. } else {
  1585. if (this.tableData.length > 0) {
  1586. this.tableDataHandle();
  1587. }
  1588. }
  1589. },
  1590. // 导入按钮事件
  1591. tableDataHandle() {
  1592. // 循环获取库存数量
  1593. for (let item of this.tableData) {
  1594. console.log(item, "循环导入");
  1595. let page = {};
  1596. if (this.form.storageId) {
  1597. page.storageId = this.form.storageId;
  1598. }
  1599. page.goodsId = item.id;
  1600. dotList(page).then(res => {
  1601. console.log(res.data, "获取到的数据");
  1602. var obj = {};
  1603. if (res.data.data.length > 0) {
  1604. obj.inventory = res.data.data[0].balanceQuantity;
  1605. if (item.dot) {
  1606. obj.dot = item.dot;
  1607. } else {
  1608. obj.dot = "";
  1609. }
  1610. }
  1611. this.form.orderItemsList.push({
  1612. ...obj,
  1613. price: item.price,
  1614. goodsId: item.id,
  1615. goodsName: item.cname,
  1616. dot: item.dot,
  1617. brandName: item.brandName,
  1618. brandId: item.brandId,
  1619. goodsNo: item.code,
  1620. // propertyName:item.typeno,
  1621. // 规格型号
  1622. propertyName: item.specificationAndModel,
  1623. // 花纹
  1624. pattern: item.brandItem,
  1625. // 商品描述
  1626. goodsDescription: item.goodsDescription,
  1627. goodsNum: item.goodsNum,
  1628. units: item.unit,
  1629. inventory: item.inventory,
  1630. // sendNum:res.data.data[0],
  1631. // 小计
  1632. subTotalMoney: item.goodsNum * item.price,
  1633. //
  1634. // inventory:item.balanceQuantity,
  1635. // 备注
  1636. remarks: item.remarks,
  1637. // 判断批次号是否可以编辑
  1638. whether: item.whether,
  1639. rebatePrice: item.rebatePrice,
  1640. // 批次号的状态
  1641. dotedittype: false,
  1642. // 价格数量
  1643. goodsNumtype: false,
  1644. // 价格
  1645. pricetype: false,
  1646. // 是否是编辑状态
  1647. mingxibaocun: true
  1648. });
  1649. console.log(this.form.orderItemsList);
  1650. });
  1651. }
  1652. this.mingxibaocun = false;
  1653. this.dialogVisible = false;
  1654. },
  1655. // 导入
  1656. goodsListSaveHandle() {
  1657. this.tableData = this.goodsListSave;
  1658. this.tableDataHandle();
  1659. },
  1660. //导入商品弹窗列表查询
  1661. onLoadfun(page, params = {}) {
  1662. console.log(params);
  1663. this.loading = true;
  1664. getList({
  1665. ...params,
  1666. current: page.currentPage,
  1667. size: page.pageSize,
  1668. customId: this.form.customerId,
  1669. stock: this.form.storageId,
  1670. enableOrNot: 1,
  1671. artsVision: this.form.belongToCorpId,
  1672. goodsTypeId: this.treeDeptId,
  1673. whetherIntegral: "0",
  1674. ...Object.assign(params, this.SelectSearch)
  1675. }).then(res => {
  1676. res.data.data.records.forEach(e => {
  1677. e.rebatePrice = 0;
  1678. });
  1679. const data = res.data.data;
  1680. this.page.total = data.total;
  1681. this.pageList.total = data.total;
  1682. this.data = data.records;
  1683. this.goodsListShow = data.records;
  1684. // 获取单价数据
  1685. for (let item of this.goodsListShow) {
  1686. let page = {};
  1687. item.goodsNum = item.goodsNum ? item.goodsNum : 0;
  1688. if (this.form.storageId) {
  1689. page.storageId = this.form.storageId;
  1690. }
  1691. page.goodsId = item.id;
  1692. if (this.form.storageId) {
  1693. dotList(page).then(res => {
  1694. item.price = res.data.data[0].inventoryCostPrice ? res.data.data[0].inventoryCostPrice : 0;
  1695. });
  1696. }
  1697. }
  1698. this.loading = false;
  1699. });
  1700. },
  1701. // 采购明细行编辑
  1702. hangeditBtn(row, index) {
  1703. for (let item of this.form.orderItemsList) {
  1704. this.picihaolistfun(item.goodsId);
  1705. getDetailsLT({ id: item.goodsId }).then(res => {
  1706. this.$set(item, "whether", res.data.data.whether);
  1707. });
  1708. }
  1709. row.dotedittype = true;
  1710. // 价格数量
  1711. row.goodsNumtype = true;
  1712. row.pricetype = true;
  1713. // 编辑和保存状态切换
  1714. this.mingxibaocun = false;
  1715. },
  1716. // 保存按钮
  1717. hangbaocun(row) {
  1718. row.dotedittype = false;
  1719. row.goodsNumtype = false;
  1720. row.pricetype = false;
  1721. this.mingxibaocun = true;
  1722. },
  1723. // 批次号获取数据
  1724. picihaolistfun(goodsId) {
  1725. dotList({
  1726. storageId: this.form.storageId,
  1727. goodsId: goodsId,
  1728. whether: 1
  1729. }).then(res => {
  1730. this.picihaolist = res.data.data;
  1731. });
  1732. },
  1733. // 编辑
  1734. editBtn(row, index) {
  1735. this.confirmEditing();
  1736. this.$refs.formContacts.dicInit();
  1737. dotList({
  1738. storageId: this.form.storageId,
  1739. goodsId: this.formContacts.goodsId
  1740. }).then(res => {
  1741. this.findObject(this.optionContactsBack.column, "dot").dicData = res.data.data;
  1742. });
  1743. },
  1744. //表头编辑
  1745. confirmEditing() {
  1746. this.editButton = false; // 让保存按钮出来
  1747. this.viewDisabled = true; // 请核审批禁用
  1748. goodsListXs(this.dicUrlWithCustomId, this.form.storageId ? this.form.storageId : "").then(res => {
  1749. this.findObject(this.optionContactsBack.column, "goodsId").dicData = res.data.data;
  1750. });
  1751. if (this.form.status == "已收货") {
  1752. this.viewDisabled = false;
  1753. return;
  1754. }
  1755. if (this.form.status == "审核中") {
  1756. this.$set(this.optionForm, "disabled", false);
  1757. this.findObject(this.optionForm.column, "customerId").disabled = true;
  1758. this.findObject(this.optionForm.column, "storageId").disabled = true;
  1759. this.findObject(this.optionForm.column, "businesDate").disabled = true;
  1760. this.findObject(this.optionForm.column, "phone").disabled = true;
  1761. this.findObject(this.optionForm.column, "receivableType").disabled = true;
  1762. this.isRevocationRequest = false; // 撤销请核按钮放开
  1763. this.viewDisabled = false; // 请核审批大按钮可点击
  1764. return;
  1765. }
  1766. this.isAddBtn = false;
  1767. if (this.form.status == "已收货") {
  1768. return;
  1769. }
  1770. if (this.form.status == "已取消" || this.form.status == "退款请核") {
  1771. this.isAddBtn = true;
  1772. }
  1773. if (this.form.status == "待发货") {
  1774. this.isAddBtn = true;
  1775. this.isDisabledTask = false;
  1776. }
  1777. this.optionContactsBack.column.forEach(its => {
  1778. if (its.prop == "goodsId" || its.prop == "goodsNum" || its.prop == "price" || its.prop == "dot" || its.prop == "remarks") {
  1779. its.disabled = false;
  1780. } else {
  1781. its.disabled = true;
  1782. }
  1783. });
  1784. // this.$set(this.optionForm, 'disabled', false)
  1785. // this.$set(this.optionContactsBack, 'disabled', false)
  1786. this.isDisabled = false;
  1787. this.isAdd = false;
  1788. const loading = this.$loading({
  1789. lock: true,
  1790. text: "加载中",
  1791. spinner: "el-icon-loading",
  1792. background: "rgba(255,255,255,0.7)"
  1793. });
  1794. if (this.form.status == "待收货" || this.form.status == "已收货") {
  1795. const loading = this.$loading({
  1796. lock: true,
  1797. text: "加载中",
  1798. spinner: "el-icon-loading",
  1799. background: "rgba(255,255,255,0.7)"
  1800. });
  1801. this.optionForm.column.forEach(its => {
  1802. if (its.prop != "remarks") {
  1803. its.disabled = true;
  1804. } else {
  1805. its.disabled = false;
  1806. }
  1807. });
  1808. this.optionContactsBack.column.forEach(its => {
  1809. if (its.prop != "remarks") {
  1810. its.disabled = true;
  1811. } else {
  1812. its.disabled = false;
  1813. }
  1814. });
  1815. loading.close();
  1816. } else if (this.form.status == "录入") {
  1817. this.isDisabledTask = false;
  1818. this.viewDisabled = false;
  1819. this.$set(this.optionForm, "disabled", false);
  1820. this.$set(this.optionContactsBack, "disabled", false);
  1821. this.isContacts = false;
  1822. //删除按钮
  1823. this.isDisabled = false;
  1824. loading.close();
  1825. } else if (this.form.status == "待确认") {
  1826. this.isDisabledTask = false;
  1827. this.isAddBtn = false;
  1828. this.isAdd = false;
  1829. this.isDisabled = false;
  1830. this.viewDisabled = false;
  1831. // this.isDisabled = true
  1832. this.buttonText = "生成任务";
  1833. loading.close();
  1834. }
  1835. if (this.form.status == "待收货") {
  1836. this.isDisabledTask = false;
  1837. this.viewDisabled = false;
  1838. }
  1839. this.form.outboundRecordsList.forEach(item => {
  1840. if (item.statusName == "待出库") {
  1841. this.isDisabledTask = true;
  1842. }
  1843. });
  1844. if (this.form.checkStatus == "审核完成") {
  1845. this.$set(this.optionForm, "disabled", false);
  1846. this.$set(this.optionContactsBack, "disabled", true);
  1847. this.findObject(this.optionForm.column, "customerId").disabled = true;
  1848. this.findObject(this.optionForm.column, "storageId").disabled = true;
  1849. this.findObject(this.optionForm.column, "businesDate").disabled = true;
  1850. this.findObject(this.optionForm.column, "phone").disabled = true;
  1851. this.findObject(this.optionForm.column, "receivableType").disabled = true;
  1852. this.isContacts = true;
  1853. this.isDisabled = true;
  1854. //添加删除按钮禁用
  1855. this.isAdd = true;
  1856. this.isAddBtn = true;
  1857. }
  1858. loading.close();
  1859. },
  1860. generateOutbound() {
  1861. if (!this.form.id) {
  1862. this.$message.error("请先保存");
  1863. } else {
  1864. if (this.buttonText === "生成任务") {
  1865. //生成任务逻辑
  1866. if (this.form.orderItemsList.length <= 0) {
  1867. this.$message.error("请录入明细");
  1868. } else {
  1869. this.$set(this.optionForm, "disabled", true);
  1870. this.$set(this.optionContactsBack, "disabled", true);
  1871. this.$refs["form"].validate((valid, done) => {
  1872. if (valid) {
  1873. this.$refs["form"].validate((valid, done) => {
  1874. done();
  1875. if (valid) {
  1876. const loading = this.$loading({
  1877. lock: true,
  1878. text: "加载中",
  1879. spinner: "el-icon-loading",
  1880. background: "rgba(255,255,255,0.7)"
  1881. });
  1882. inboundTask({
  1883. bsType: "CG",
  1884. ...this.form
  1885. })
  1886. .then(res => {
  1887. this.refresh(res.data.data.id);
  1888. // this.isDisabledTask = false
  1889. this.editButton = true;
  1890. this.isDisabledTask = true;
  1891. // 将按钮文本更改为"撤销任务"
  1892. this.buttonText = "撤销任务";
  1893. // 将按钮颜色更改为对应的颜色
  1894. this.buttonColor = "warning"; // 比如改为warning
  1895. this.refresh(res.data.data.id, true);
  1896. this.isContacts = true;
  1897. this.isAdd = true;
  1898. this.isDisabled = true;
  1899. // this.findObject(this.optionForm,'disabled') = true
  1900. // this.findObject(this.optionContactsBack,'disabled') = true
  1901. this.$message.success("生成入库任务成功");
  1902. this.isApplySettlement = false;
  1903. loading.close();
  1904. // generateShipTask(this.form).then(res => {
  1905. // console.log(res.data);
  1906. // // 将按钮文本更改为"撤销任务"
  1907. // this.buttonText = '撤销任务';
  1908. // // 将按钮颜色更改为对应的颜色
  1909. // this.buttonColor = 'warning'; // 比如改为warning
  1910. // this.refresh(res.data.data.id, true)
  1911. // this.isContacts = true
  1912. // this.isAdd = true
  1913. // this.isDisabled = true
  1914. // // this.findObject(this.optionForm,'disabled') = true
  1915. // // this.findObject(this.optionContactsBack,'disabled') = true
  1916. // this.$message.success("生成入库任务成功");
  1917. // this.isApplySettlement = false
  1918. // loading.close();
  1919. //
  1920. // }).finally(() => {
  1921. // loading.close();
  1922. // });
  1923. })
  1924. .finally(() => {
  1925. loading.close();
  1926. });
  1927. } else {
  1928. return false;
  1929. }
  1930. });
  1931. done();
  1932. } else {
  1933. this.$message.error("请选择仓库");
  1934. }
  1935. });
  1936. }
  1937. } else {
  1938. this.$refs["form"].validate((valid, done) => {
  1939. console.log(valid);
  1940. if (valid) {
  1941. const loading = this.$loading({
  1942. lock: true,
  1943. text: "加载中",
  1944. spinner: "el-icon-loading",
  1945. background: "rgba(255,255,255,0.7)"
  1946. });
  1947. revokeInboundTask(this.form)
  1948. .then(res => {
  1949. this.isDisabledTask = true;
  1950. this.editButton = true;
  1951. // 将按钮文本更改为"生成任务"
  1952. this.buttonText = "生成任务";
  1953. // 将按钮颜色还原为success
  1954. this.buttonColor = "success";
  1955. this.$message.success("撤销入库成功");
  1956. this.refresh(res.data.data.id);
  1957. this.isApplySettlement = false;
  1958. loading.close();
  1959. })
  1960. .catch(err => {
  1961. console.log(err);
  1962. if (err instanceof TooManyResultsException) {
  1963. // 不显示错误消息
  1964. return;
  1965. }
  1966. // 显示其他错误消息
  1967. this.$message.error("发生错误,请稍后重试");
  1968. })
  1969. .finally(() => {
  1970. loading.close();
  1971. });
  1972. done();
  1973. }
  1974. });
  1975. }
  1976. }
  1977. },
  1978. //联系人change
  1979. contactsChange(e) {
  1980. console.log(e);
  1981. console.log(this.contactsOption);
  1982. // 假设this.contactsOption是你的数组对象
  1983. let matchedContact = this.contactsOption.find(item => item.contacts == e);
  1984. // 判断是否找到匹配的对象
  1985. this.$set(this.form, "phone", matchedContact.tel);
  1986. // this.$set(this.form, 'recAddress', matchedContact.belongtoarea + matchedContact.detailedAddress)
  1987. },
  1988. //修改提交触发
  1989. editCustomer() {
  1990. this.$refs["form"].validate((valid, done) => {
  1991. done();
  1992. let picihao = false;
  1993. if (valid) {
  1994. for (let i in this.form.orderItemsList) {
  1995. this.form.orderItemsList[i].subTotalMoney = this.form.orderItemsList[i].goodsNum * this.form.orderItemsList[i].price;
  1996. if (this.form.orderItemsList[i].goodsNum <= 0) {
  1997. this.$message.warning(`采购明细序号${Number(i) + 1}的数量不能为零`);
  1998. picihao = true;
  1999. }
  2000. if (!this.form.orderItemsList[i].sendNum) {
  2001. this.form.orderItemsList[i].sendNum = 0;
  2002. }
  2003. }
  2004. this.mingxibaocun = true;
  2005. if (picihao) {
  2006. return;
  2007. }
  2008. const loading = this.$loading({
  2009. lock: true,
  2010. text: "加载中",
  2011. spinner: "el-icon-loading",
  2012. background: "rgba(255,255,255,0.7)"
  2013. });
  2014. this.form.storageName = this.form.$storageId ? this.form.$storageId : "";
  2015. submit({
  2016. bsType: "CG",
  2017. ...this.form
  2018. })
  2019. .then(res => {
  2020. if (res.data.code === 601) {
  2021. if (this.onLoad.id) {
  2022. console.log(2);
  2023. this.refresh(this.onLoad.id, true);
  2024. }
  2025. this.$message({
  2026. type: "error",
  2027. message: res.data.msg
  2028. });
  2029. return true;
  2030. }
  2031. this.$message.success("保存成功");
  2032. this.refresh(res.data.data.id);
  2033. this.isDisabledTask = false;
  2034. // this.editButton = true // 让编辑按钮出来
  2035. // this.isDisabledTask = false;
  2036. // this.viewDisabled = false;
  2037. this.isAddBtn = false; // 表格的添加商品禁用
  2038. this.$set(this.optionForm, "disabled", false);
  2039. this.$set(this.optionContactsBack, "disabled", false);
  2040. this.isContacts = true; // 基础信息联系人 和地址插槽禁用
  2041. // 表格的删除按钮禁用
  2042. this.isDisabled = false;
  2043. this.isAdd = false; // 表格的编辑和保存按钮禁用
  2044. loading.close();
  2045. })
  2046. .finally(() => {
  2047. loading.close();
  2048. });
  2049. } else {
  2050. return false;
  2051. }
  2052. });
  2053. },
  2054. //保存
  2055. save() {
  2056. this.$refs["form"].validate((valid, done) => {
  2057. done();
  2058. if (valid) {
  2059. const loading = this.$loading({
  2060. lock: true,
  2061. text: "加载中",
  2062. spinner: "el-icon-loading",
  2063. background: "rgba(255,255,255,0.7)"
  2064. });
  2065. inboundTask({
  2066. bsType: "CG",
  2067. ...this.form
  2068. })
  2069. .then(res => {
  2070. console.log(1);
  2071. this.refresh(res.data.data.id);
  2072. this.isDisabledTask = false;
  2073. loading.close();
  2074. })
  2075. .finally(() => {
  2076. loading.close();
  2077. });
  2078. } else {
  2079. return false;
  2080. }
  2081. });
  2082. },
  2083. inBtn() {},
  2084. //关闭弹窗表单
  2085. beforeClose(done, type) {
  2086. console.log(type);
  2087. // if(row == "add"){
  2088. // this.form.sharedCompanyId = this.form.sharedCompanyId?this.form.sharedCompanyId:''
  2089. // this.form.sharedCompanyName = this.form.sharedCompanyName?this.form.sharedCompanyName:''
  2090. // }
  2091. console.log("this.form.sharedCompanyId", this.form.sharedCompanyId);
  2092. console.log("this.form.sharedCompanyName", this.form.sharedCompanyName);
  2093. done();
  2094. },
  2095. refresh(id, type) {
  2096. const loading = this.$loading({
  2097. lock: true,
  2098. text: "加载中",
  2099. spinner: "el-icon-loading",
  2100. background: "rgba(255,255,255,0.7)"
  2101. });
  2102. getDetails({ id: id })
  2103. .then(res => {
  2104. this.form = res.data.data;
  2105. let ordForm = { srcBillNo: this.form.ordNo };
  2106. let _this = this;
  2107. this.dataList = res.data.data.paymentRecordsList ? res.data.data.paymentRecordsList : [];
  2108. this.$nextTick(() => {
  2109. this.$refs.formContacts.doLayout();
  2110. });
  2111. // if (this.form.status !== '录入' &&
  2112. // this.form.status !== '退款中' &&
  2113. // this.form.status !== '已取消' &&
  2114. // this.form.status !== '退款请核' &&
  2115. // this.form.status !== '已退款' &&
  2116. // this.form.status !== '待确认' &&
  2117. // this.form.status !== '待收货') {
  2118. // this.isApplySettlement = false;
  2119. // }
  2120. if (this.form.status == "审核中") {
  2121. this.isApplySettlement = false;
  2122. this.isRevocationRequest = false; // 撤销请核能点击
  2123. }
  2124. // if (this.form.status == '待确认') {
  2125. // this.isApplySettlement = true;
  2126. // }
  2127. // if (this.form.status === '已退款' || this.form.status === '已收货' || this.form.status === '已取消') {
  2128. // // 禁用编辑按钮
  2129. // console.log('按钮全部禁用');
  2130. // this.isDisabledTask = true;
  2131. // this.viewDisabled = true;
  2132. // }
  2133. // if (this.form.status === '已收货') {
  2134. // this.isDisabledTask = true;
  2135. // this.viewDisabled = true;
  2136. // }
  2137. //
  2138. // if (this.form.status == '退款中') {
  2139. // this.isConfirmRefundBtn = false;
  2140. // }
  2141. // if (this.form.status == '已取消') {
  2142. // this.isConfirmRefundBtn = true;
  2143. // }
  2144. //
  2145. if (this.form.generateTask == "已生成") {
  2146. this.buttonText = "撤销任务";
  2147. // this.isDisabledTask = false;
  2148. this.buttonColor = "warning";
  2149. }
  2150. // if (this.form.status == '退款请核' || this.form.status == '退款中') {
  2151. // this.isRevocationRequest = false;
  2152. // }
  2153. //成本、毛利对销售角色隐藏
  2154. this.optionForm.column.forEach(its => {
  2155. if (
  2156. JSON.parse(localStorage.getItem("saber-userInfo"))
  2157. .content.role_name.split(",")
  2158. .includes("销售")
  2159. ) {
  2160. if (its.prop == "cost" || its.prop == "grossProfit") {
  2161. this.$set(its, "display", false);
  2162. }
  2163. }
  2164. });
  2165. this.form.orderItemsList.forEach(items => {
  2166. if (!items.subTotalMoney) {
  2167. items.subTotalMoney = items.goodsNum * items.price;
  2168. items.grossProfit = items.subTotalMoney - items.costprie;
  2169. }
  2170. });
  2171. if (res.data.data.checkStatus == "审核完成") {
  2172. console.log("审核完成");
  2173. this.$set(this.optionForm, "disabled", true);
  2174. this.$set(this.optionContactsBack, "disabled", true);
  2175. this.isContacts = true;
  2176. this.isDisabled = true;
  2177. //添加删除按钮禁用
  2178. this.isAdd = true;
  2179. }
  2180. loading.close();
  2181. })
  2182. .catch(() => {
  2183. loading.close();
  2184. });
  2185. },
  2186. operationType() {},
  2187. //请核关闭
  2188. choceScheduleFun() {
  2189. this.checkScheduleDialog = false;
  2190. },
  2191. //关闭审核
  2192. choceCheckFun() {
  2193. this.refresh(this.onLoad.id);
  2194. // this.isDisabledTask = false
  2195. this.isExamineBtn = !this.isExamineBtn;
  2196. this.checkDialog = false;
  2197. },
  2198. //请核数据qing
  2199. applySettlement(type) {
  2200. this.$confirm("您确定请核吗?", {
  2201. confirmButtonText: "确定",
  2202. cancelButtonText: "取消",
  2203. type: "warning"
  2204. }).then(() => {
  2205. this.$refs["form"].validate((valid, done) => {
  2206. done();
  2207. if (valid) {
  2208. const data = {
  2209. id: this.form.id,
  2210. url: "/tirePartsMall/salesManagement/purchaseOrder/index",
  2211. pageStatus: "this.$store.getters.purchaseStatus",
  2212. pageLabel: "采购订单"
  2213. };
  2214. const loading = this.$loading({
  2215. lock: true,
  2216. text: "加载中",
  2217. spinner: "el-icon-loading",
  2218. background: "rgba(255,255,255,0.7)"
  2219. });
  2220. checkOrderCG({ ...data })
  2221. .then(res => {
  2222. this.refresh(res.data.data.id);
  2223. this.$message.success("请核成功");
  2224. this.isApplySettlement = !this.isApplySettlement;
  2225. loading.close();
  2226. console.log(res);
  2227. })
  2228. .catch(() => {
  2229. loading.close();
  2230. });
  2231. }
  2232. });
  2233. });
  2234. },
  2235. //确认退款
  2236. confirmRefundBtn() {
  2237. this.$confirm("您确定退款吗?", {
  2238. confirmButtonText: "确定",
  2239. cancelButtonText: "取消",
  2240. type: "warning"
  2241. }).then(() => {
  2242. const loading = this.$loading({
  2243. lock: true,
  2244. text: "加载中",
  2245. spinner: "el-icon-loading",
  2246. background: "rgba(255,255,255,0.7)"
  2247. });
  2248. // this.form.orderItemsList.forEach((items) => {
  2249. // let brandName = items.brandId
  2250. // items.brandId = items.brandName
  2251. // items.brandName = brandName
  2252. // let goodsName = items.goodsId
  2253. // items.goodsId = items.goodsName
  2254. // items.goodsName = goodsName
  2255. // })
  2256. confirmRefund({ ...this.form })
  2257. .then(res => {
  2258. loading.close();
  2259. this.$message.success("确定退款成功");
  2260. })
  2261. .catch(() => {
  2262. loading.close();
  2263. });
  2264. });
  2265. },
  2266. //审批
  2267. examineBtn() {
  2268. this.checkData = this.$route.query.check;
  2269. console.info("this.checkData---11111---", this.checkData);
  2270. this.checkDialog = true;
  2271. },
  2272. //撤销请核
  2273. revocationRequest() {
  2274. this.$confirm("您确定撤回此次申请吗?", {
  2275. confirmButtonText: "确定",
  2276. cancelButtonText: "取消",
  2277. type: "warning"
  2278. }).then(() => {
  2279. const loading = this.$loading({
  2280. lock: true,
  2281. text: "加载中",
  2282. spinner: "el-icon-loading",
  2283. background: "rgba(255,255,255,0.7)"
  2284. });
  2285. // this.form.orderItemsList.forEach((items) => {
  2286. // if (!items.subTotalMoney) {
  2287. // items.subTotalMoney = items.goodsNum * items.price
  2288. // items.grossProfit = items.subTotalMoney - items.costprie
  2289. // }
  2290. // let brandName = items.brandId
  2291. // items.brandId = items.brandName
  2292. // items.brandName = brandName
  2293. // let goodsName = items.goodsId
  2294. // items.goodsId = items.goodsName
  2295. // items.goodsName = goodsName
  2296. // })
  2297. revokeCheckOrderCG({ ...this.form })
  2298. .then(res => {
  2299. this.isRevocationRequest = !this.isRevocationRequest;
  2300. this.refresh(res.data.data.id);
  2301. this.$message.success("撤回成功");
  2302. loading.close();
  2303. })
  2304. .catch(() => {
  2305. loading.close();
  2306. });
  2307. });
  2308. },
  2309. rowDelBox(row, index, type) {
  2310. this.$confirm("确定将选择数据删除?", {
  2311. confirmButtonText: "确定",
  2312. cancelButtonText: "取消",
  2313. type: "warning"
  2314. }).then(() => {
  2315. if (row.id) {
  2316. delOrderItem({ ids: row.id }).then(res => {
  2317. this.form.orderItemsList.splice(index, 1);
  2318. this.$message.success("操作成功!");
  2319. });
  2320. } else {
  2321. this.form[type].splice(index, 1);
  2322. this.$message.success("操作成功!");
  2323. }
  2324. });
  2325. },
  2326. // 明细信息多选
  2327. selectionContacts(list) {
  2328. this.selectionMultilist = list;
  2329. },
  2330. // 一键删除
  2331. batchDelete() {
  2332. if (this.selectionMultilist.length == 0) {
  2333. return this.$message.warning("请选择要删除的数据");
  2334. }
  2335. this.$confirm("确定将选择数据删除?", {
  2336. confirmButtonText: "确定",
  2337. cancelButtonText: "取消",
  2338. type: "warning"
  2339. }).then(() => {
  2340. let multiList = this.selectionMultilist;
  2341. let arr = this.form.orderItemsList;
  2342. // 获取有id 的数据
  2343. const itemsWithId = multiList.filter(item => item.hasOwnProperty("id"));
  2344. let arrIds = itemsWithId.map(item => item.id); // 获取id 数据
  2345. // 把选中的删除掉
  2346. multiList.forEach(item => {
  2347. for (let index in arr) {
  2348. if (JSON.stringify(item) == JSON.stringify(arr[index])) {
  2349. arr.splice(Number(index), 1);
  2350. }
  2351. }
  2352. });
  2353. // 有id 的处理
  2354. if (itemsWithId.length != 0) {
  2355. delOrderItem({ ids: arrIds.join(",") }).then(res => {
  2356. this.$message.success("操作成功!");
  2357. });
  2358. }
  2359. });
  2360. },
  2361. rowSave(form, done, loading) {
  2362. form.subTotalMoney = form.goodsNum * form.price;
  2363. form.goodsName = form.$goodsId;
  2364. if (this.isStatus) {
  2365. console.log(form);
  2366. done(form);
  2367. } else {
  2368. this.$message.error("请选择相同商户的商品");
  2369. }
  2370. console.log(form);
  2371. // this.form.sharedCompanyId = res.data.data.sharedCompanyId
  2372. // this.form.sharedCompanyName = res.data.data.sharedCompanyName
  2373. },
  2374. rowUpdate(form, index, done, loading) {
  2375. this.$set(form, "goodsName", form.$goodsId);
  2376. console.log(form);
  2377. done(form);
  2378. },
  2379. // 新增商品
  2380. rowAdd(row) {
  2381. if (!this.form.customerId) {
  2382. this.$message.error("请选择供应商");
  2383. return;
  2384. }
  2385. this.optionContactsBack.column.forEach(its => {
  2386. if (its.prop == "goodsId" || its.prop == "goodsNum" || its.prop == "price" || its.prop == "dot" || its.prop == "remarks") {
  2387. its.disabled = false;
  2388. } else {
  2389. its.disabled = true;
  2390. }
  2391. });
  2392. console.log("新增了", row);
  2393. this.getAllWorkDicts();
  2394. this.refreshChange();
  2395. this.goodsListSave = [];
  2396. this.dialogVisible = true;
  2397. // this.$refs.formContacts.rowAdd()
  2398. },
  2399. uploadAfter(res, done, loading, column) {
  2400. if (Array.isArray(res)) {
  2401. if (res instanceof Array) {
  2402. this.form.orderItemsList = this.form.orderItemsList.concat(res);
  2403. res.forEach(item => {
  2404. dotList({
  2405. storageId: this.form.storageId,
  2406. goodsId: res.goodsId
  2407. }).then(e => {
  2408. this.findObject(this.optionContactsBack.column, "dot").dicData = e.data.data;
  2409. });
  2410. });
  2411. }
  2412. } else {
  2413. this.$message.error(res);
  2414. }
  2415. this.excelBox = false;
  2416. loading = false;
  2417. done(res);
  2418. },
  2419. derivation() {
  2420. window.open(`${this.templateUrl}?${this.website.tokenHeader}=${getToken()}`);
  2421. },
  2422. uploadBefore(file, done, loading) {
  2423. done();
  2424. loading = true;
  2425. },
  2426. // 采购明细 导入按钮
  2427. excelDialogfun(name) {
  2428. if (name == "名称") {
  2429. this.findObject(this.excelOption.column, "excelFile").action = "/api/blade-sales-part/ship/import-item";
  2430. this.templateUrl = "/api/blade-sales-part/ship/export-item";
  2431. } else if (name == "code") {
  2432. this.findObject(this.excelOption.column, "excelFile").action = "/api/blade-sales-part/ship/import-item-code";
  2433. this.templateUrl = "/api/blade-sales-part/ship/export-item-code";
  2434. }
  2435. this.excelBox = true;
  2436. },
  2437. //打印
  2438. handlePrint() {
  2439. this.switchDialog = !this.switchDialog;
  2440. },
  2441. onClose(val) {
  2442. this.switchDialog = val;
  2443. },
  2444. //自定义列保存
  2445. async saveColumnTwo(ref, option, optionBack, code) {
  2446. /**
  2447. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  2448. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  2449. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  2450. */
  2451. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  2452. isProcurement({ param: "whether.model" }).then(res => {
  2453. if (res.data.data == 1) {
  2454. this.findObject(this.optionContacts.column, "pattern").label = "规格型号1";
  2455. }
  2456. });
  2457. if (inSave) {
  2458. this.$message.success("保存成功");
  2459. //关闭窗口
  2460. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  2461. }
  2462. },
  2463. //自定义列重置
  2464. async resetColumnTwo(ref, option, optionBack, code) {
  2465. this[option] = this[optionBack];
  2466. isProcurement({ param: "whether.model" }).then(res => {
  2467. if (res.data.data == 1) {
  2468. this.findObject(this.optionContacts.column, "pattern").label = "规格型号1";
  2469. }
  2470. });
  2471. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  2472. if (inSave) {
  2473. this.$message.success("重置成功");
  2474. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  2475. }
  2476. },
  2477. backToList(type) {
  2478. this.$emit("backToList", type);
  2479. },
  2480. // 弹框的重置
  2481. resetCrud() {
  2482. this.$message.success("重置成功");
  2483. },
  2484. // 弹窗的保存
  2485. saveCrud() {
  2486. this.$message.success("保存成功");
  2487. }
  2488. }
  2489. };
  2490. </script>
  2491. <style lang="scss" scoped>
  2492. ::v-deep .el-form-item {
  2493. margin-bottom: 8px !important;
  2494. }
  2495. </style>