detailsPage.vue 103 KB

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