detailsPage.vue 108 KB

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