detailsPage.vue 97 KB

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