detailsPage.vue 98 KB

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