detailsPage.vue 93 KB

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