detailsPageEdit.vue 71 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052
  1. <template>
  2. <div class="borderless" v-loading="pageLoading">
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <!-- <i class="back-icon el-icon-arrow-left"></i><i style="font-style:normal">返回管理列表</i>-->
  6. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  7. @click="backToList">返回列表
  8. </el-button>
  9. </div>
  10. <div class="add-customer-btn">
  11. <el-button
  12. v-if="detailData.seeDisabled"
  13. size="small"
  14. @click="detailData.seeDisabled = false"
  15. type="primary"
  16. >编辑</el-button>
  17. <el-button
  18. class="el-button--small-yh"
  19. type="primary"
  20. size="small"
  21. :disabled="detailData.seeDisabled"
  22. v-if="form.deliveryStatus == '已到货'"
  23. @click="cancelArrival"
  24. >撤销到货</el-button>
  25. <el-button
  26. class="el-button--small-yh"
  27. type="primary"
  28. size="small"
  29. :disabled="detailData.seeDisabled || arrivalDisabled"
  30. v-if="form.deliveryStatus == '已发货'"
  31. @click="confirmArrival"
  32. >确认到货</el-button>
  33. <el-button
  34. class="el-button--small-yh"
  35. type="primary"
  36. @click="revokeOutGoods"
  37. size="small"
  38. v-if="form.deliveryStatus == '已发货'"
  39. :disabled="detailData.seeDisabled || arrivalDisabled"
  40. >撤销发货</el-button>
  41. <el-button
  42. class="el-button--small-yh"
  43. type="primary"
  44. @click="sendOutGoods"
  45. size="small"
  46. v-if="form.deliveryStatus == '录入'"
  47. :disabled="detailData.seeDisabled || !form.id || arrivalDisabled"
  48. >确认发货</el-button>
  49. <el-button
  50. class="el-button--small-yh"
  51. size="small"
  52. type="success" @click="copyOrder"
  53. :disabled="detailData.seeDisabled || !form.id || arrivalDisabled">
  54. 复制单据
  55. </el-button>
  56. <el-button
  57. class="el-button--small-yh"
  58. type="primary"
  59. :disabled="disabled || detailData.seeDisabled || arrivalDisabled"
  60. @click="editCustomer(false)"
  61. :loading="saveLoading"
  62. size="small"
  63. >保 存
  64. </el-button>
  65. </div>
  66. </div>
  67. <div class="customer-main">
  68. <el-form :model="form" ref="form" label-width="130px" class="demo-ruleForm">
  69. <containerTitle title="基础资料"></containerTitle>
  70. <basic-container style="margin-bottom: 10px">
  71. <el-row>
  72. <el-col v-for="(item,index) in basicData.column" :key="index" :span="item.span?item.span:8">
  73. <el-form-item :label="item.label" :prop="item.prop" :rules="item.rules">
  74. <!-- <avue-input-tree v-if="item.prop === 'corpsTypeId'" leaf-only multiple :props="{label:'title'}" v-model="form[item.prop]" placeholder="请选择内容" type="tree" :dic="dic"-->
  75. <!-- ></avue-input-tree>-->
  76. <el-date-picker v-if="item.type === 'datetime'" style="width: 100%;" v-model="form[item.prop]"
  77. size="small" type="datetime" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss" :disabled="item.disabled || detailData.seeDisabled || arrivalDisabled || deliverDisabled"/>
  78. <el-date-picker v-else-if="item.type === 'date'" style="width: 100%;" v-model="form[item.prop]"
  79. size="small" type="date" placeholder="选择日期"
  80. :disabled="detailData.seeDisabled || arrivalDisabled || deliverDisabled"/>
  81. <crop-select
  82. v-else-if="item.prop === 'corpId'"
  83. v-model="form[item.prop]"
  84. corpType="KH"
  85. :disabled="detailData.seeDisabled || arrivalDisabled || deliverDisabled"
  86. style="width: 100%"
  87. ></crop-select>
  88. <crop-select
  89. v-else-if="item.prop === 'salesCompany'"
  90. v-model="form[item.prop]"
  91. corpType="GS"
  92. :disabled="detailData.seeDisabled || arrivalDisabled || deliverDisabled"
  93. ></crop-select>
  94. <!-- <selectComponent v-else-if="item.prop === 'corpId'" v-model="form[item.prop]"-->
  95. <!-- :configuration="configuration" style="width: 100%" :disabled="detailData.seeDisabled"/>-->
  96. <!-- <selectComponent v-else-if="item.prop === 'salesCompany'" v-model="form[item.prop]" typeData="GS"-->
  97. <!-- :configuration="companyConfiguration" style="width: 100%" :disabled="detailData.seeDisabled"/>-->
  98. <el-select v-else-if="item.prop === 'deliveryStatus'" v-model="form[item.prop]" placeholder="请选择" clearable filterable style="width: 100%" size="small" :disabled="item.disabled || detailData.seeDisabled || arrivalDisabled || deliverDisabled">
  99. <el-option v-for="(item,index) in statusOption" :key="index" :label="item.dictValue" :value="item.dictValue" size="small"></el-option>
  100. </el-select>
  101. <el-select v-else-if="item.prop === 'warehouseType'" v-model="form[item.prop]" placeholder="请选择" clearable filterable style="width: 100%" size="small" :disabled="detailData.seeDisabled || arrivalDisabled || deliverDisabled">
  102. <el-option v-for="(item,index) in warehouseTypeOption" :key="index" :label="item.dictValue" :value="item.dictValue"></el-option>
  103. </el-select>
  104. <!-- <avue-input-tree-->
  105. <!-- v-else-if="item.prop === 'warehouseType'"-->
  106. <!-- leaf-only-->
  107. <!-- placeholder="请选择内容"-->
  108. <!-- :dic="warehouseType"-->
  109. <!-- type="tree"-->
  110. <!-- v-model="form[item.prop]"-->
  111. <!-- style="width: 100%"-->
  112. <!-- size="small"-->
  113. <!-- @change="warehouseTreeChange"-->
  114. <!-- >-->
  115. <!-- </avue-input-tree>-->
  116. <warehouse-select v-else-if="item.prop === 'storageId'" v-model="form[item.prop]"
  117. :configuration="configurationWarehouse" style="width: 100%" :disabled="detailData.seeDisabled || arrivalDisabled || deliverDisabled"/>
  118. <el-input
  119. v-else-if="item.type == 'number'"
  120. placeholder="请输入"
  121. v-input-limit="2"
  122. size="small"
  123. :disabled="item.disabled || detailData.seeDisabled || arrivalDisabled || deliverDisabled"
  124. v-model.trim="form[item.prop]"
  125. />
  126. <el-input type="textarea" v-else-if="item.type === 'textarea'" v-model.trim="form[item.prop]" size="small" autocomplete="off" :disabled="item.disabled || detailData.seeDisabled || arrivalDisabled"></el-input>
  127. <el-input type="age" v-else v-model.trim="form[item.prop]" size="small" autocomplete="off" :disabled="item.disabled || detailData.seeDisabled || arrivalDisabled || deliverDisabled"></el-input>
  128. </el-form-item>
  129. </el-col>
  130. </el-row>
  131. </basic-container>
  132. <containerTitle title="商品信息"></containerTitle>
  133. <basic-container style="margin-bottom: 10px">
  134. <avue-crud
  135. :option="customerContact"
  136. v-model="contactsForm"
  137. :data="goodsShowData"
  138. ref="crudContact"
  139. @row-save="rowSave"
  140. @row-click="handleRowClick"
  141. @row-update="rowUpdate"
  142. @row-del="rowDel"
  143. @saveColumn="saveColumn('goods')"
  144. @resetColumn="resetColumn"
  145. :cell-style="goodsRowClassName"
  146. >
  147. <template slot="code" slot-scope="{row,index}">
  148. <!-- <el-button type="text" size="mini" style="padding:4px 10px;float:left" @click="commodityChoice(row)" :disabled="detailData.seeDisabled || !row.$cellEdit || arrivalDisabled || deliverDisabled">选择</el-button>-->
  149. <span>{{ row.code }}</span>
  150. </template>
  151. <template slot-scope="{row,index}" slot="menu">
  152. <el-button
  153. type="text"
  154. size="small"
  155. @click="rowCell(row,index)"
  156. :disabled="detailData.seeDisabled || arrivalDisabled"
  157. >{{ row.$cellEdit ? '保存' : '修改' }}
  158. </el-button>
  159. <el-button
  160. size="small"
  161. icon="el-icon-delete"
  162. type="text"
  163. @click="rowDel(row, index)"
  164. :disabled="detailData.seeDisabled || arrivalDisabled || deliverDisabled"
  165. v-if="!row.$cellEdit"
  166. >删 除</el-button>
  167. </template>
  168. <template slot="menuLeft" slot-scope="{size}">
  169. <el-tabs v-model="goodsActives" @tab-click="handleClick">
  170. <el-tab-pane label="商品" name="goods" :key="'first'" :disabled="goodsDisabled">
  171. </el-tab-pane>
  172. <el-tab-pane label="赠品" name="gift" :key="'second'" :disabled="goodsDisabled">
  173. </el-tab-pane>
  174. </el-tabs>
  175. <el-button type="primary"
  176. icon="el-icon-plus"
  177. size="small"
  178. @click="marketDialog = true"
  179. :disabled="detailData.seeDisabled || arrivalDisabled || deliverDisabled"
  180. v-if="goodsActives == 'goods'"
  181. >录入明细
  182. </el-button>
  183. <el-button type="primary"
  184. icon="el-icon-plus"
  185. size="small"
  186. @click="commoditySelection"
  187. :disabled="detailData.seeDisabled || arrivalDisabled || deliverDisabled"
  188. v-if="goodsActives == 'gift'"
  189. >录入明细
  190. </el-button>
  191. <el-button type="info" :size="size" icon="el-icon-printer" @click.stop="openReport()">报 表</el-button>
  192. <el-button
  193. type="warning"
  194. icon="el-icon-refresh"
  195. size="small"
  196. :disabled="detailData.seeDisabled || arrivalDisabled || deliverDisabled"
  197. @click="resetStock"
  198. >库存刷新</el-button>
  199. </template>
  200. <template slot="actualQuantity" slot-scope="{ row }">
  201. <el-input
  202. v-if="row.$cellEdit"
  203. v-model.trim="row.actualQuantity"
  204. v-input-limit="0"
  205. @change="actualQuantityChange(row)"
  206. :disabled="detailData.seeDisabled || arrivalDisabled || deliverDisabled"
  207. ></el-input>
  208. <span v-else>{{ row.actualQuantity | IntegerFormat }}</span>
  209. </template>
  210. <!-- 到货数量-->
  211. <template slot="arrivalQuantity" slot-scope="{ row }">
  212. <el-input
  213. v-if="row.$cellEdit"
  214. v-model.trim="row.arrivalQuantity"
  215. v-input-limit="0"
  216. @input="arrivalQuantityChange(row)"
  217. ></el-input>
  218. <span v-else>{{ row.arrivalQuantity }}</span>
  219. </template>
  220. <template slot="corpId" slot-scope="{ row, index }">
  221. <crop-select
  222. v-if="row.$cellEdit"
  223. v-model="row.corpId"
  224. :cropIndex="index"
  225. corpType="GYS"
  226. @getCorpData="getcorpId"
  227. :disabled="detailData.seeDisabled || arrivalDisabled || deliverDisabled"
  228. ></crop-select>
  229. <span v-else>{{ row.corpName }}</span>
  230. </template>
  231. </avue-crud>
  232. </basic-container>
  233. <fee-info
  234. ref="feeInfo"
  235. :orderFeesList="advantageProjectData"
  236. :disabled="detailData.seeDisabled || arrivalDisabled || deliverDisabled"
  237. feeUrl="/blade-deliver-goods/deliveryfees/update"
  238. />
  239. <!-- <containerTitle title="费用明细"></containerTitle>-->
  240. <!-- <basic-container style="margin-bottom: 10px">-->
  241. <!-- <avue-crud-->
  242. <!-- :option="advantageProject"-->
  243. <!-- v-model="advantageProjectForm"-->
  244. <!-- :data="advantageProjectData"-->
  245. <!-- ref="crudProject"-->
  246. <!-- @row-save="rowSaveProject"-->
  247. <!-- @row-update="rowUpdateProject"-->
  248. <!-- @row-del="rowDelProject"-->
  249. <!-- @saveColumn="saveColumn('fees')"-->
  250. <!-- >-->
  251. <!-- <template slot="code" slot-scope="{row,index}">-->
  252. <!-- <el-button type="text" size="mini" style="padding:4px 10px;float:left" @click="choice(row)" :disabled="detailData.seeDisabled || !row.$cellEdit">选择</el-button>-->
  253. <!-- <span>{{ row.code }}</span>-->
  254. <!-- </template>-->
  255. <!-- <template slot="corpId" slot-scope="{ row }">-->
  256. <!-- <selectComponent v-if="row.$cellEdit" v-model="row.corpId"-->
  257. <!-- :configuration="configuration" @receiveList="receiveList"/>-->
  258. <!-- <span v-else>-->
  259. <!-- <span v-for="item in configuration.dicData" v-if="item.id == row.corpId">{{ item.cname }}</span>-->
  260. <!-- </span>-->
  261. <!-- </template>-->
  262. <!-- <template slot="amount" slot-scope="{ row }">-->
  263. <!-- <el-input v-if="row.$cellEdit" v-model.trim="row.amount"-->
  264. <!-- size="small" v-input-limit="2"-->
  265. <!-- ></el-input>-->
  266. <!-- <span v-else>{{ row.amount }}</span>-->
  267. <!-- </template>-->
  268. <!-- <template slot="settlmentAmount" slot-scope="{ row }">-->
  269. <!-- <el-input v-if="row.$cellEdit" v-model.trim="row.settlmentAmount"-->
  270. <!-- size="small" v-input-limit="2"-->
  271. <!-- ></el-input>-->
  272. <!-- <span v-else>{{ row.settlmentAmount }}</span>-->
  273. <!-- </template>-->
  274. <!-- <template slot-scope="{row,index}" slot="menu">-->
  275. <!-- <el-button-->
  276. <!-- type="text"-->
  277. <!-- size="small"-->
  278. <!-- @click="rowCellTwo(row,index)"-->
  279. <!-- :disabled="detailData.seeDisabled"-->
  280. <!-- >{{ row.$cellEdit ? '保存' : '修改' }}-->
  281. <!-- </el-button>-->
  282. <!-- <el-button-->
  283. <!-- size="small"-->
  284. <!-- icon="el-icon-delete"-->
  285. <!-- type="text"-->
  286. <!-- @click="rowDelProject(row, index)"-->
  287. <!-- :disabled="detailData.seeDisabled"-->
  288. <!-- v-if="!row.$cellEdit"-->
  289. <!-- >删 除</el-button>-->
  290. <!-- </template>-->
  291. <!-- <template slot="menuLeft" slot-scope="{size}">-->
  292. <!-- <el-button type="primary"-->
  293. <!-- icon="el-icon-plus"-->
  294. <!-- size="small"-->
  295. <!-- @click="costIncrease"-->
  296. <!-- :disabled="detailData.seeDisabled"-->
  297. <!-- >录入明细-->
  298. <!-- </el-button>-->
  299. <!-- </template>-->
  300. <!-- </avue-crud>-->
  301. <!-- </basic-container>-->
  302. <containerTitle title="附件上传"></containerTitle>
  303. <basic-container style="margin-bottom: 40px">
  304. <avue-crud
  305. :option="bankOfDeposit"
  306. v-model="bankOfDepositForm"
  307. :data="bankOfDepositData"
  308. @row-save="rowSaveBankOfDeposit"
  309. @row-update="rowUpdateBankOfDeposit"
  310. @row-del="rowDelBankOfDeposit"
  311. :upload-after="uploadAfter"
  312. ref="uploadCrud"
  313. >
  314. <template slot="menuLeft">
  315. <el-button
  316. type="primary"
  317. icon="el-icon-plus"
  318. size="small"
  319. @click.stop="$refs.uploadCrud.rowAdd()"
  320. :disabled="detailData.seeDisabled || arrivalDisabled || deliverDisabled"
  321. >上传</el-button
  322. >
  323. </template>
  324. <template slot="menu" slot-scope="{ row, index }">
  325. <el-button
  326. size="small"
  327. icon="el-icon-edit"
  328. type="text"
  329. @click="$refs.uploadCrud.rowEdit(row, index)"
  330. :disabled="detailData.seeDisabled || arrivalDisabled || deliverDisabled"
  331. >编 辑</el-button
  332. >
  333. <el-button
  334. size="small"
  335. icon="el-icon-delete"
  336. type="text"
  337. @click="rowDelBankOfDeposit(row, index)"
  338. :disabled="detailData.seeDisabled || arrivalDisabled || deliverDisabled"
  339. >删 除</el-button
  340. >
  341. </template>
  342. </avue-crud>
  343. </basic-container>
  344. </el-form>
  345. </div>
  346. <el-dialog
  347. title="导入商品"
  348. append-to-body
  349. class="el-dialogDeep"
  350. :visible.sync="dialogVisible"
  351. width="80%"
  352. :close-on-click-modal="false"
  353. :destroy-on-close="true"
  354. :close-on-press-escape="false"
  355. @close="closeGoods">
  356. <el-row :style="{height: rowHeight}">
  357. <el-col :span="5" style="height: 100%;overflow-y: auto">
  358. <div>
  359. <el-scrollbar>
  360. <basic-container>
  361. <avue-tree :option="treeOption" :data="treeDataGoods" @node-click="nodeClick"/>
  362. </basic-container>
  363. </el-scrollbar>
  364. </div>
  365. </el-col>
  366. <el-col :span="19">
  367. <basic-container>
  368. <avue-crud :option="optionTwo"
  369. :table-loading="loading"
  370. :data="data"
  371. ref="crud"
  372. @refresh-change="refreshChange"
  373. @selection-change="selectionChange"
  374. :page.sync="page"
  375. @search-change="goodsSearch"
  376. @on-load="onLoad"></avue-crud>
  377. </basic-container>
  378. </el-col>
  379. </el-row>
  380. <span slot="footer" class="dialog-footer">
  381. <el-button @click="dialogVisible = false">取 消</el-button>
  382. <el-button type="primary" @click="importGoods" v-if="commodityData !== true">导入</el-button>
  383. <el-button type="primary" @click="importChoice" v-if="commodityData === true"
  384. :disabled="tableData.length !== 1">导入</el-button>
  385. </span>
  386. </el-dialog>
  387. <el-dialog
  388. title="导入费用"
  389. append-to-body
  390. class="el-dialogDeep"
  391. :visible.sync="dialogCost"
  392. width="80%"
  393. :close-on-click-modal="false"
  394. :destroy-on-close="true"
  395. :close-on-press-escape="false"
  396. @close="closeFees">
  397. <el-row :style="{height: rowHeight}">
  398. <el-col :span="5" style="height: 100%;overflow-y: auto">
  399. <div>
  400. <el-scrollbar>
  401. <basic-container>
  402. <avue-tree :option="treeOptionCost" :data="treeData" @node-click="nodeClickCost"/>
  403. </basic-container>
  404. </el-scrollbar>
  405. </div>
  406. </el-col>
  407. <el-col :span="19">
  408. <basic-container>
  409. <avue-crud :option="optionTwoCost"
  410. :table-loading="loadingCost"
  411. :data="dataCost"
  412. ref="crud"
  413. @refresh-change="refreshChangeCost"
  414. @selection-change="selectionChangeCost"
  415. :page.sync="pageCost"
  416. @searchChange="feesSearch"
  417. @on-load="onLoadCost">
  418. </avue-crud>
  419. </basic-container>
  420. </el-col>
  421. </el-row>
  422. <span slot="footer" class="dialog-footer">
  423. <el-button @click="dialogCost = false">取 消</el-button>
  424. <el-button type="primary" @click="importCost" v-if="choiceData !== true">导入</el-button>
  425. <el-button type="primary" @click="choiceCost" v-if="choiceData === true"
  426. :disabled="tableDataCost.length !== 1">导入</el-button>
  427. </span>
  428. </el-dialog>
  429. <!-- 导入销售明细-->
  430. <el-dialog
  431. title="导入销售"
  432. append-to-body
  433. class="el-dialogDeep"
  434. :visible.sync="marketDialog"
  435. width="60%"
  436. :close-on-click-modal="false"
  437. :destroy-on-close="true"
  438. :modal-append-to-body='false'
  439. :close-on-press-escape="false"
  440. v-dialog-drag>
  441. <market-detail
  442. @importMarket="importMarket"
  443. @close="closeMarkeDialog"
  444. systemType="GN"
  445. >
  446. </market-detail>
  447. </el-dialog>
  448. <report-dialog
  449. :switchDialog="switchDialog"
  450. :reportId="form.id"
  451. reportName="客户收货确认"
  452. @onClose="onClose()"
  453. ></report-dialog>
  454. </div>
  455. </template>
  456. <script>
  457. import {
  458. typeSave, detail,
  459. corpstypeTree,
  460. corpsattn,
  461. corpsbank,
  462. corpsitem,
  463. // getList,
  464. sendOutGoods,
  465. revokeOutGoods,
  466. confirmArrival,
  467. cancelArrival
  468. } from "@/api/basicData/deliveryNotice"
  469. import {getList} from "@/api/basicData/commodityType";
  470. import customerContact from "./configuration/customerContact.json"
  471. import advantageProject from "./configuration/advantageProject.json"
  472. import bankOfDeposit from "./configuration/bankOfDeposit.json"
  473. import commodity from "./configuration/commodity.json"
  474. import optionTwoCost from "./configuration/mainListCost.json"
  475. import {getDeptLazyTree,getDeptLazyTreeTwo, customerList} from "@/api/basicData/basicFeesDesc";
  476. import {customerList as wareHouseType} from "@/api/basicData/basicStorageType"
  477. import {customerList as selectWareHouse} from "@/api/basicData/basicStorageDesc"
  478. import {selectGoodsNum} from "@/api/basicData/inventoryAccount"
  479. import { contrastObj, contrastList } from "@/util/contrastData";
  480. import marketDetail from "@/components/procurement/market";
  481. import feeInfo from "@/components/fee-info/main";
  482. import {
  483. isDiscount,
  484. isPercentage,
  485. micrometerFormat,
  486. IntegerFormat
  487. } from "@/util/validate";
  488. import reportDialog from "@/components/report-dialog/main";
  489. export default {
  490. name: "detailsPage",
  491. props: {
  492. detailData: {
  493. type: Object
  494. }
  495. },
  496. components: {
  497. marketDetail,
  498. feeInfo,
  499. reportDialog,
  500. },
  501. data() {
  502. return {
  503. configuration: {
  504. multipleChoices: false,
  505. multiple: false,
  506. collapseTags: false,
  507. placeholder: '请点击右边按钮选择',
  508. dicData: []
  509. },
  510. companyConfiguration: {
  511. multipleChoices: false,
  512. multiple: false,
  513. collapseTags: false,
  514. placeholder: '请点击右边按钮选择',
  515. dicData: []
  516. },
  517. configurationWarehouse: {
  518. multipleChoices: false,
  519. multiple: false,
  520. collapseTags: false,
  521. placeholder: "请点击右边按钮选择",
  522. dicData: [],
  523. clearable: true,
  524. },
  525. form: {},
  526. data: [],
  527. loadingCost: false,
  528. choiceData: false,
  529. commodityData: false,
  530. dataCost: [],
  531. treeDataGoods: [],
  532. treeData: [],
  533. choiceIndex: '',
  534. dialogCost: false,
  535. treeDeptId: '',
  536. treeDeptIdCost: '',
  537. pageCost: {
  538. pageSize: 10,
  539. currentPage: 1,
  540. total: 0
  541. },
  542. page: {
  543. pageSize: 10,
  544. currentPage: 1,
  545. total: 0
  546. },
  547. loading: false,
  548. contactsForm: {},
  549. optionTwo: commodity,
  550. optionTwoCost: optionTwoCost,
  551. treeOptionCost: {
  552. nodeKey: 'id',
  553. lazy: true,
  554. treeLoad: function (node, resolve) {
  555. const parentId = (node.level === 0) ? 0 : node.data.id;
  556. getDeptLazyTree(parentId).then(res => {
  557. resolve(res.data.data.map(item => {
  558. return {
  559. ...item,
  560. leaf: !item.hasChildren
  561. }
  562. }))
  563. });
  564. },
  565. addBtn: false,
  566. menu: false,
  567. size: 'small',
  568. props: {
  569. labelText: '标题',
  570. label: 'title',
  571. value: 'value',
  572. children: 'children'
  573. }
  574. },
  575. treeOption: {
  576. nodeKey: 'id',
  577. lazy: true,
  578. treeLoad: function (node, resolve) {
  579. const parentId = (node.level === 0) ? 0 : node.data.id;
  580. getDeptLazyTreeTwo(parentId).then(res => {
  581. resolve(res.data.data.map(item => {
  582. return {
  583. ...item,
  584. leaf: !item.hasChildren
  585. }
  586. }))
  587. });
  588. },
  589. addBtn: false,
  590. menu: false,
  591. size: 'small',
  592. props: {
  593. labelText: '标题',
  594. label: 'title',
  595. value: 'value',
  596. children: 'children'
  597. }
  598. },
  599. dialogVisible: false,
  600. advantageProjectForm: {},
  601. bankOfDepositForm: {},
  602. contactsData: [],
  603. advantageProjectData: [],
  604. disabled: false,
  605. saveLoading: false,
  606. bankOfDepositData: [],
  607. tableDataCost: [],
  608. dic: [],
  609. tableData: [],
  610. customerContact: {},
  611. advantageProject: {},
  612. bankOfDeposit: bankOfDeposit,
  613. basicData: {
  614. column: [
  615. {
  616. label: '系统编号',//发货通知(点击)
  617. prop: 'sysNo',
  618. disabled: true,
  619. rules: [
  620. {
  621. required: false,
  622. message: ' ',
  623. trigger: 'blur'
  624. }
  625. ]
  626. }, {
  627. label: '客户名称',
  628. prop: 'corpId',
  629. span: 16,
  630. rules: [
  631. {
  632. required: true,
  633. message: ' ',
  634. trigger: 'blur'
  635. }
  636. ]
  637. }, {
  638. label: '单据状态',
  639. prop: 'deliveryStatus',
  640. disabled: true,
  641. rules: [
  642. {
  643. required: true,
  644. message: ' ',
  645. trigger: 'blur'
  646. }
  647. ]
  648. }, {
  649. label: '所属公司',
  650. prop: 'salesCompany', //salesCompany
  651. span: 16,
  652. rules: [
  653. {
  654. required: true,
  655. message: ' ',
  656. trigger: 'blur'
  657. }
  658. ]
  659. }, {
  660. label: '仓库类型',
  661. prop: 'warehouseType',//字典表
  662. rules: [
  663. {
  664. required: true,
  665. message: ' ',
  666. trigger: 'blur'
  667. }
  668. ]
  669. }, {
  670. label: '仓库名称',
  671. prop: 'storageId',
  672. span: 16,
  673. rules: [
  674. {
  675. required: true,
  676. message: ' ',
  677. trigger: 'blur'
  678. }
  679. ]
  680. },{
  681. label: '匹配订单号',
  682. prop: 'srcOrderNo',
  683. rules: [
  684. {
  685. required: false,
  686. message: ' ',
  687. trigger: 'blur'
  688. }
  689. ]
  690. }, {
  691. label: '出库金额',
  692. prop: 'deliveryAmount',
  693. disabled: false,
  694. rules: [
  695. {
  696. required: false,
  697. message: ' ',
  698. trigger: 'blur'
  699. }
  700. ]
  701. }, {
  702. label: '出库数量',
  703. prop: 'totalQuantity',
  704. disabled: false,
  705. rules: [
  706. {
  707. required: false,
  708. message: ' ',
  709. trigger: 'blur'
  710. }
  711. ]
  712. }, {
  713. label: '出库日期',
  714. prop: 'businessDate',
  715. type: 'datetime',
  716. rules: [
  717. {
  718. required: true,
  719. message: ' ',
  720. trigger: 'blur'
  721. }
  722. ]
  723. }, {
  724. label: '制单时间',
  725. type: 'datetime',
  726. prop: 'createTime',
  727. disabled: true,
  728. rules: [
  729. {
  730. required: false,
  731. message: ' ',
  732. trigger: 'blur'
  733. }
  734. ]
  735. }, {
  736. label: '费用合计',
  737. prop: 'totalCost',
  738. rules: [
  739. {
  740. required: false,
  741. message: ' ',
  742. trigger: 'blur'
  743. }
  744. ]
  745. },{
  746. label: '收货地址',
  747. prop: 'arrivalAddress',
  748. rules: [
  749. {
  750. required: false,
  751. message: ' ',
  752. trigger: 'blur'
  753. }
  754. ]
  755. }, {
  756. label: '收货人',
  757. prop: 'arrivalContact',
  758. rules: [
  759. {
  760. required: false,
  761. message: ' ',
  762. trigger: 'blur'
  763. }
  764. ]
  765. }, {
  766. label: '收货电话',
  767. prop: 'arrivalTel',
  768. rules: [
  769. {
  770. required: false,
  771. message: ' ',
  772. trigger: 'blur'
  773. }
  774. ]
  775. }, {
  776. label: '包装要求',
  777. prop: 'packageRemarks',
  778. rules: [
  779. {
  780. required: false,
  781. message: ' ',
  782. trigger: 'blur'
  783. }
  784. ]
  785. },{
  786. label: '赠送积分',
  787. prop: 'presenterIntegral',
  788. disabled: true,
  789. rules: [
  790. {
  791. required: false,
  792. message: ' ',
  793. trigger: 'blur'
  794. }
  795. ]
  796. },{
  797. label: '兑换积分',
  798. prop: 'convertIntegral',
  799. disabled: true,
  800. rules: [
  801. {
  802. required: false,
  803. message: ' ',
  804. trigger: 'blur'
  805. }
  806. ]
  807. }, {
  808. label: "备注",
  809. span: 24,
  810. type: 'textarea',
  811. prop: "otherRemarks",
  812. mock: {
  813. type: 'county'
  814. }
  815. }
  816. ]
  817. },
  818. statusOption: [],
  819. warehouseTypeOption: [],
  820. // 仓库类型
  821. warehouseType: [],
  822. // 仓库名称
  823. warehouseName: [],
  824. maxFeeNum: 0,
  825. maxGoodsNum: 0,
  826. oldForm: {
  827. orderStatus: "录入"
  828. },
  829. oldGoodsList: [],
  830. oldGiftList: [],
  831. oldFeesList: [],
  832. oldUploadList: [],
  833. // 导入销售订单明细
  834. marketDialog: false,
  835. // 弹窗高度
  836. rowHeight: '',
  837. // 查询时loading页面
  838. pageLoading: false,
  839. goodsActives: 'goods',
  840. // 用于判断 tab是否是当前
  841. saveActives: '',
  842. goodsDisabled: false,
  843. // 赠品信息数据
  844. giftData: [],
  845. // 商品信息展示数据
  846. goodsShowData: [],
  847. // 确认收货禁用
  848. deliverDisabled: false,
  849. // 确认到货禁用
  850. arrivalDisabled: false,
  851. switchDialog: false,
  852. }
  853. },
  854. mounted() {
  855. this.$nextTick(() => {
  856. // 监听浏览器高度变化,改变表格高度
  857. window.onresize = () => {
  858. this.rowHeight = (window.innerHeight - 130) + 'px'
  859. }
  860. })
  861. },
  862. filters: {
  863. IntegerFormat(num) {
  864. return IntegerFormat(num);
  865. }
  866. },
  867. //初始化查询
  868. async created() {
  869. this.rowHeight = (window.innerHeight - 130) + 'px'
  870. this.customerContact = await this.getColumnData(this.getColumnName(21), customerContact);
  871. this.advantageProject = await this.getColumnData(this.getColumnName(22), advantageProject);
  872. this.getWorkDicts("order_status").then(res => {
  873. this.statusOption = res.data.data
  874. })
  875. this.getWorkDicts("warehouseType").then(res => {
  876. this.warehouseTypeOption = res.data.data
  877. })
  878. this.$set(this.form,'deliveryStatus','录入')
  879. this.$set(this.form, 'presenterIntegral' , 0)
  880. this.$set(this.form, 'convertIntegral' , 0)
  881. wareHouseType().then(res => {
  882. this.warehouseType = res.data.data.records
  883. this.warehouseType.forEach(item => {
  884. this.$set(item, 'label', item.cname)
  885. this.$set(item, 'value', item.id)
  886. if (item.hasChildren) {
  887. this.$set(item, 'children', [])
  888. }
  889. })
  890. let result = [], temp = {}
  891. for(let i = 0; i < this.warehouseType.length;i++) {
  892. temp[this.warehouseType[i].id] = this.warehouseType[i]
  893. }
  894. for (let j = 0;j < this.warehouseType.length;j++) {
  895. let current = this.warehouseType[j]
  896. let tempCurrentParent = temp[current.parentId]
  897. if (tempCurrentParent) {
  898. if (!tempCurrentParent["children"]) {
  899. tempCurrentParent["children"] = []
  900. }
  901. tempCurrentParent["children"].push(current)
  902. } else {
  903. result.push(current)
  904. }
  905. }
  906. this.warehouseType = result
  907. });
  908. selectWareHouse().then(res => {
  909. this.warehouseName = res.data.data.records
  910. })
  911. if (this.detailData.id) {
  912. let id = this.detailData.id
  913. this.queryData(id)
  914. }else if (this.detailData.form){
  915. this.form = JSON.parse(this.detailData.form);
  916. delete this.form.createTime
  917. delete this.form.id
  918. delete this.form.sysNo
  919. this.$set(this.form, 'deliveryStatus', '录入')
  920. this.$set(this.form, 'srcOrderNo', this.form.orgOrderNo)
  921. this.form.orderItemsList.forEach(item => {
  922. this.$set(item, 'contractNumber', this.form.orgOrderNo)
  923. })
  924. this.contactsData = this.form.orderItemsList.filter(item => {
  925. return item.goodType == 0
  926. })
  927. this.giftData = this.form.orderItemsList.filter(item => {
  928. return item.goodType == 1
  929. })
  930. this.giftData.forEach(item => {
  931. this.$set(item, 'deliveryAmount', item.amount)
  932. this.$set(item, 'specificationAndModel', item.itemType)
  933. this.$set(item, 'orgOrderNo', this.form.orgOrderNo)
  934. this.$set(item, 'srcOrderNo', this.form.srcOrderNo)
  935. this.$set(item, "srcId", item.id)
  936. this.$set(item, 'actualQuantity', item.orderQuantity)
  937. delete item.id
  938. delete item.pid
  939. delete item.createTime
  940. delete item.createUser
  941. delete item.status
  942. delete item.updateTime
  943. delete item.updateUser
  944. })
  945. this.goodsShowData = this.giftData;
  946. this.goodsActives = 'goods';
  947. this.handleClick({name: this.goodsActives})
  948. // this.contactsData = this.form.orderItemsList
  949. delete this.form.orderItemsList
  950. this.configuration.dicData = this.form.corpName
  951. delete this.form.corpName
  952. if (this.form.belongToCorpList) {
  953. this.$set(this.form, 'salesCompany', this.form.belongToCorpId)
  954. delete this.form.belongToCorpId
  955. this.companyConfiguration.dicData = this.companyConfiguration.dicData.concat(this.form.belongToCorpList)
  956. }
  957. delete this.form.belongToCorpList
  958. this.$set(this.form, 'deliveryAmount', 0)
  959. this.$set(this.form, 'totalQuantity', 0)
  960. this.$set(this.form, 'totalCost', 0)
  961. this.advantageProjectData = this.form.orderFeesList;
  962. delete this.form.orderFeesList
  963. this.advantageProjectData.forEach(item => {
  964. delete item.createDept
  965. delete item.createTime
  966. delete item.createUser
  967. delete item.id
  968. delete item.isDeleted
  969. delete item.pid
  970. delete item.status
  971. delete item.tenantId
  972. delete item.updateTime
  973. delete item.updateUser
  974. })
  975. this.contactsData.forEach(item => {
  976. this.$set(item, 'specificationAndModel', item.itemType)
  977. this.$set(item, 'orgOrderNo', this.form.orgOrderNo)
  978. this.$set(item, 'srcOrderNo', this.form.srcOrderNo)
  979. this.$set(item, "srcId", item.id)
  980. this.$set(item, "actualQuantity", (Number(item.orderQuantity) - Number(item.actualQuantity)))
  981. this.$set(item, "arrivalQuantity", item.actualQuantity)
  982. this.$set(item, "deliveryAmount", item.amount)
  983. this.$set(item, "deliveryAmount", item.amount)
  984. this.$set(item, "inventoryNumber", item.storageQuantity)
  985. this.form.deliveryAmount += Number(item.deliveryAmount)
  986. this.form.totalQuantity += Number(item.actualQuantity)
  987. this.form.totalCost += Number(item.deliveryAmount)
  988. // 出库数量和出库金额的比例
  989. this.$set(item, 'scale', (item.deliveryAmount / item.actualQuantity))
  990. delete item.id
  991. delete item.pid
  992. delete item.createTime
  993. delete item.createUser
  994. delete item.status
  995. delete item.updateTime
  996. delete item.updateUser
  997. })
  998. } else if (this.detailData.copyId) {
  999. let id = this.detailData.copyId
  1000. this.queryData(id, true)
  1001. }
  1002. this.oldForm = Object.assign({}, this.form)
  1003. },
  1004. watch: {
  1005. },
  1006. methods: {
  1007. queryData(id, isCopy = false, type) {
  1008. this.pageLoading = true
  1009. detail(id).then(res => {
  1010. this.form = res.data.data;
  1011. if (this.form.deliveryStatus == '已发货') {
  1012. this.deliverDisabled = true;
  1013. this.arrivalDisabled = false;
  1014. } else if (this.form.deliveryStatus == '已到货') {
  1015. this.arrivalDisabled = true;
  1016. this.deliverDisabled = false;
  1017. } else {
  1018. this.arrivalDisabled = false;
  1019. this.deliverDisabled = false;
  1020. }
  1021. if (this.deliverDisabled) {
  1022. this.customerContact.column.forEach(item => {
  1023. if (item.prop == 'arrivalQuantity') {
  1024. item.disabled = false
  1025. } else {
  1026. item.disabled = true
  1027. }
  1028. })
  1029. } else {
  1030. this.customerContact.column.forEach(item => {
  1031. item.disabled = false
  1032. })
  1033. }
  1034. // this.contactsData = this.form.deliveryItemsList
  1035. this.contactsData = this.form.deliveryItemsList.filter(item => {
  1036. return item.goodType == 0
  1037. })
  1038. this.giftData = this.form.deliveryItemsList.filter(item => {
  1039. return item.goodType == 1
  1040. })
  1041. this.giftData.forEach(item => {
  1042. this.$set(item, 'deliveryAmount', item.amount)
  1043. })
  1044. this.goodsShowData = this.giftData;
  1045. this.goodsActives = 'goods';
  1046. this.handleClick({name: this.goodsActives})
  1047. this.advantageProjectData = this.form.deliveryFeesList
  1048. this.bankOfDepositData = this.form.deliveryFilesList
  1049. this.configuration.dicData = this.form.corpName
  1050. this.form.deliveryAmount = 0
  1051. this.form.totalQuantity = 0
  1052. this.contactsData.forEach(item => {
  1053. this.form.deliveryAmount += Number(item.deliveryAmount)
  1054. this.form.totalQuantity += Number(item.actualQuantity)
  1055. // 出库金额和出库数量的比例
  1056. this.$set(item, 'scale', (item.deliveryAmount / item.actualQuantity))
  1057. })
  1058. if (this.form.companyName) {
  1059. this.companyConfiguration.dicData = this.companyConfiguration.dicData.concat(this.form.companyName)
  1060. }
  1061. if (this.form.storageMap) {
  1062. this.configurationWarehouse.dicData = this.form.storageMap
  1063. }
  1064. let feesData = []
  1065. this.form.deliveryFeesList.forEach(item => {
  1066. let a = {
  1067. cname: item.corpName,
  1068. id: item.corpId
  1069. }
  1070. feesData.push(a)
  1071. })
  1072. this.configuration.dicData = this.configuration.dicData.concat(feesData)
  1073. // 去重
  1074. this.removeRepeat()
  1075. delete this.form.deliveryItemsList
  1076. delete this.form.deliveryFeesList
  1077. delete this.form.deliveryFilesList
  1078. delete this.form.corpName
  1079. delete this.form.companyName
  1080. // 获取最大值
  1081. let num = []
  1082. this.advantageProjectData.forEach(item => {
  1083. num.push(item.sort)
  1084. })
  1085. if (num.length == 0) {
  1086. this.maxFeeNum = 0;
  1087. } else {
  1088. this.maxFeeNum = num.reduce((a, b) => {
  1089. return b > a? b: a;
  1090. })
  1091. }
  1092. let goodsNum = []
  1093. this.contactsData.forEach(item => {
  1094. goodsNum.push(item.sort)
  1095. })
  1096. if (goodsNum.length == 0) {
  1097. this.maxGoodsNum = 0;
  1098. } else {
  1099. this.maxGoodsNum = goodsNum.reduce((a, b) => {
  1100. return b > a? b: a;
  1101. })
  1102. }
  1103. this.oldGoodsList = []
  1104. this.oldGiftList = []
  1105. this.oldFeesList = []
  1106. this.oldUploadList = []
  1107. this.oldForm = Object.assign({}, this.form)
  1108. this.oldGoodsList = this.deepClone(this.contactsData)
  1109. this.oldGiftList = this.deepClone(this.giftData)
  1110. this.oldFeesList = this.deepClone(this.advantageProjectData)
  1111. this.oldUploadList = this.deepClone(this.bankOfDepositData)
  1112. if (isCopy) {
  1113. delete this.form.sysNo
  1114. delete this.form.id
  1115. this.contactsData.forEach(item => {
  1116. delete item.id
  1117. delete item.pid
  1118. })
  1119. this.advantageProjectData.forEach(item => {
  1120. delete item.id
  1121. delete item.pid
  1122. })
  1123. this.bankOfDepositData.forEach(item => {
  1124. delete item.id
  1125. delete item.pid
  1126. })
  1127. this.form.deliveryStatus == '录入'
  1128. }
  1129. if (type == '发货') {
  1130. this.$nextTick(() => {
  1131. this.form.deliveryItemsList = this.contactsData.concat(this.giftData)
  1132. this.form.deliveryFeesList = this.$refs.feeInfo.submitData()
  1133. this.form.deliveryFilesList = this.bankOfDepositData
  1134. if (typeof this.form.corpsTypeId == 'object') {
  1135. this.form.corpsTypeId = this.form.corpsTypeId.join(",")
  1136. }
  1137. this.pageLoading = true
  1138. this.saveActives = ''
  1139. sendOutGoods(this.form).then(res => {
  1140. this.$message.success('发货成功')
  1141. this.queryData(res.data.data.id)
  1142. }).finally(() => {
  1143. this.pageLoading = false
  1144. })
  1145. })
  1146. } else if (type == '到货') {
  1147. if (this.goodsShowData.findIndex(item => item.goodType == 0) == -1) {
  1148. this.form.deliveryItemsList = this.goodsShowData.concat(this.contactsData)
  1149. } else {
  1150. this.form.deliveryItemsList = this.goodsShowData.concat(this.giftData)
  1151. }
  1152. this.pageLoading = true
  1153. this.saveActives = ''
  1154. confirmArrival(this.form).then(res => {
  1155. this.$message.success('已确认到货')
  1156. this.queryData(this.form.id)
  1157. }).catch(() => {
  1158. this.pageLoading = false
  1159. })
  1160. }
  1161. }).finally(() => {
  1162. this.saveLoading = false
  1163. this.pageLoading = false
  1164. });
  1165. },
  1166. getcorpId(row) {
  1167. this.contactsData[row.index].corpId = row.id;
  1168. this.contactsData[row.index].corpName = row.cname;
  1169. },
  1170. // 出库数量变化时调用
  1171. actualQuantityChange(row) {
  1172. // if (row.scale) {
  1173. // row.deliveryAmount = Number(row.actualQuantity) * Number(row.scale)
  1174. // }
  1175. if (this.goodsActives == 'goods') {
  1176. if (Number(row.actualQuantity) < Number(row.arrivalQuantity)) {
  1177. row.arrivalQuantity = row.actualQuantity
  1178. }
  1179. row.deliveryAmount = Number(row.actualQuantity) * Number(row.price)
  1180. this.form.deliveryAmount = 0
  1181. this.form.totalQuantity = 0
  1182. this.contactsData.forEach(item => {
  1183. this.form.deliveryAmount += Number(item.deliveryAmount)
  1184. this.form.totalQuantity += Number(item.actualQuantity)
  1185. })
  1186. } else {
  1187. row.integral = Number(row.integralMultiples) * Number(row.actualQuantity)
  1188. this.$set(this.form, 'convertIntegral' , 0)
  1189. this.goodsShowData.forEach(item => {
  1190. this.form.convertIntegral = (Number(this.form.convertIntegral) + Number(item.integral)).toFixed(2)
  1191. })
  1192. }
  1193. },
  1194. // 到货数量变化计算
  1195. arrivalQuantityChange(row) {
  1196. if (this.goodsActives == 'goods') {
  1197. if (Number(row.arrivalQuantity) > Number(row.actualQuantity)) {
  1198. this.$message.error('到货数量不能超过出库数量')
  1199. row.arrivalQuantity = 0
  1200. }
  1201. row.integral = Number(row.integralMultiples) * Number(row.arrivalQuantity)
  1202. this.$set(this.form, 'presenterIntegral' , 0)
  1203. this.goodsShowData.forEach(item => {
  1204. this.form.presenterIntegral = (Number(this.form.presenterIntegral) + Number(item.integral)).toFixed(2)
  1205. })
  1206. } else {
  1207. }
  1208. },
  1209. // 类别变换时触发
  1210. warehouseTreeChange(id) {
  1211. this.warehouseName = []
  1212. if (this.firstComing) {
  1213. if (!this.form.storageId) {
  1214. this.$set(this.form, 'storageId', null)
  1215. } else {
  1216. this.form.storageId = null
  1217. }
  1218. }
  1219. let data = {
  1220. storageTypeId: id
  1221. }
  1222. selectWareHouse(data).then(res => {
  1223. this.warehouseName = res.data.data.records
  1224. })
  1225. this.firstComing = true
  1226. },
  1227. //点击行可编辑
  1228. handleRowClick(row, event, column) {
  1229. },
  1230. //商品编辑
  1231. rowCell(row, index) {
  1232. this.$refs.crudContact.rowCell(row, index)
  1233. },
  1234. //费用编辑
  1235. rowCellTwo(row, index) {
  1236. this.$refs.crudProject.rowCell(row, index)
  1237. },
  1238. //费用新增触发
  1239. costIncrease() {
  1240. this.dialogCost = !this.dialogCost
  1241. this.choiceData = false
  1242. },
  1243. //商品新增触发
  1244. commoditySelection() {
  1245. this.dialogVisible = !this.dialogVisible
  1246. this.tableData = []
  1247. this.commodityData = false
  1248. },
  1249. //点击费用明细选择触发
  1250. choice(row) {
  1251. this.dialogCost = !this.dialogCost
  1252. this.choiceData = true
  1253. this.choiceIndex = row.$index
  1254. },
  1255. //点击商品明细选择触发
  1256. commodityChoice(row) {
  1257. this.dialogVisible = !this.dialogVisible
  1258. this.commodityData = true
  1259. this.choiceIndexT = row.$index
  1260. },
  1261. //导入商品触发
  1262. importChoice() {
  1263. if (this.tableData.length === 1) {
  1264. this.contactsData[this.choiceIndexT].cname = this.tableData[0].cname
  1265. this.contactsData[this.choiceIndexT].code = this.tableData[0].code
  1266. this.contactsData[this.choiceIndexT].typeno = this.tableData[0].typeno
  1267. this.contactsData[this.choiceIndexT].specificationAndModel = this.tableData[0].typeno
  1268. this.contactsData[this.choiceIndexT].itemId = this.tableData[0].id
  1269. this.contactsData[this.choiceIndexT].priceCategory = this.tableData[0].goodsTypeName
  1270. selectGoodsNum({
  1271. goodsId: this.tableData[0].id,
  1272. itemType: this.tableData[0].typeno,
  1273. tradeType: 'GN'
  1274. }).then(res => {
  1275. this.contactsData[this.choiceIndexT].storageQuantity = res.data.data
  1276. })
  1277. }
  1278. this.dialogVisible = !this.dialogVisible
  1279. this.commodityData = false
  1280. },
  1281. //费用编辑导入触发
  1282. choiceCost() {
  1283. if (this.tableDataCost.length === 1) {
  1284. this.advantageProjectData[this.choiceIndex].feeName = this.tableDataCost[0].cname
  1285. this.advantageProjectData[this.choiceIndex].itemId = this.tableDataCost[0].id
  1286. this.advantageProjectData[this.choiceIndex].code = this.tableDataCost[0].code
  1287. }
  1288. this.dialogCost = !this.dialogCost
  1289. this.choiceData = false
  1290. },
  1291. //费用导入触发
  1292. importCost() {
  1293. // this.advantageProjectForm = this.advantageProjectForm.concat(this.tableDataCost)
  1294. if (this.tableDataCost.length > 0) {
  1295. for (let item in this.tableDataCost) {
  1296. this.tableDataCost[item].itemId = this.tableDataCost[item].id
  1297. this.tableDataCost[item].feeName = this.tableDataCost[item].cname
  1298. this.tableDataCost[item].sort = this.maxFeeNum + 1
  1299. this.maxFeeNum++
  1300. delete this.tableDataCost[item].id
  1301. this.$refs.crudProject.rowCellAdd(this.tableDataCost[item]);
  1302. this.$refs.crudProject.rowCell(this.tableDataCost[item], this.advantageProjectForm.length - 1)
  1303. }
  1304. }
  1305. this.tableDataCost = []
  1306. this.dialogCost = false
  1307. },
  1308. //确认导入触发
  1309. importGoods() {
  1310. // this.contactsData = this.contactsData.concat(this.tableData)
  1311. if (this.tableData.length > 0) {
  1312. for (let item in this.tableData) {
  1313. selectGoodsNum({
  1314. goodsId: this.tableData[item].id,
  1315. itemType: this.tableData[item].typeno,
  1316. tradeType: 'GN'
  1317. }).then(res =>{
  1318. this.tableData[item].storageQuantity = res.data.data
  1319. this.$set(this.tableData[item], 'specificationAndModel', this.tableData[item].typeno)
  1320. this.tableData[item].itemId = this.tableData[item].id
  1321. this.tableData[item].priceCategory = this.tableData[item].goodsTypeName
  1322. delete this.tableData[item].goodsTypeName
  1323. delete this.tableData[item].id
  1324. delete this.tableData[item].status
  1325. delete this.tableData[item].isDeleted
  1326. this.$set(this.tableData[item], 'inventoryNumber', 0)
  1327. this.$set(this.tableData[item], 'actualQuantity', 0)
  1328. this.$set(this.tableData[item], 'inventoryAmount', 0)
  1329. this.$set(this.tableData[item], 'deliveryAmount', 0)
  1330. this.tableData[item].price = 0
  1331. this.tableData[item].amount = 0
  1332. if (this.goodsActives == "goods") {
  1333. this.$set(this.tableData[item], 'goodType', 0)
  1334. this.arrivalQuantityChange(this.tableData[item])
  1335. } else {
  1336. this.$set(this.tableData[item], 'goodType', 1)
  1337. this.$set(this.tableData[item], 'integralMultiples', this.tableData[item].integral)
  1338. this.actualQuantityChange(this.tableData[item])
  1339. }
  1340. this.$set(this.tableData[item], 'integral', '0')
  1341. this.tableData[item].sort = this.maxGoodsNum + 1
  1342. this.maxGoodsNum++
  1343. this.$refs.crudContact.rowCellAdd(this.tableData[item]);
  1344. this.$refs.crudContact.rowCell(this.tableData[item], this.contactsData.length - 1)
  1345. if (this.goodsActives == "goods") {
  1346. this.arrivalQuantityChange(this.tableData[item])
  1347. } else {
  1348. this.actualQuantityChange(this.tableData[item])
  1349. }
  1350. })
  1351. }
  1352. }
  1353. this.dialogVisible = false
  1354. },
  1355. closeGoods() {
  1356. this.treeDataGoods = [];
  1357. this.treeDeptId = "";
  1358. },
  1359. closeFees() {
  1360. this.treeDeptIdCost = "";
  1361. this.treeData = [];
  1362. },
  1363. //选中触发
  1364. selectionChange(list) {
  1365. this.tableData = list
  1366. },
  1367. //费用选中触发
  1368. selectionChangeCost(list) {
  1369. this.tableDataCost = list
  1370. },
  1371. //导入页左商品类型查询
  1372. nodeClick(data) {
  1373. this.treeDeptId = data.id;
  1374. this.page.currentPage = 1;
  1375. this.onLoad(this.page);
  1376. },
  1377. //导入页左费用类型查询
  1378. nodeClickCost(data) {
  1379. this.treeDeptIdCost = data.id;
  1380. this.pageCost.currentPage = 1;
  1381. this.onLoadCost(this.pageCost);
  1382. },
  1383. //刷新触发
  1384. refreshChange() {
  1385. this.treeDeptId = '';
  1386. this.page.currentPage = 1;
  1387. this.onLoad(this.page);
  1388. },
  1389. //费用刷新触发
  1390. refreshChangeCost() {
  1391. this.treeDeptIdCost = '';
  1392. this.pageCost.currentPage = 1;
  1393. this.onLoadCost(this.pageCost);
  1394. },
  1395. //新增商品信息保存触发
  1396. rowSave(row, done, loading) {
  1397. // this.contactsData.push(row)
  1398. done()
  1399. },
  1400. //修改商品信息触发
  1401. rowUpdate(row, index, done, loading) {
  1402. done(row);
  1403. },
  1404. //删除商品信息触发
  1405. rowDel(row, index, donerowDel) {
  1406. this.$confirm("确定将选择数据删除?", {
  1407. confirmButtonText: "确定",
  1408. cancelButtonText: "取消",
  1409. type: "warning"
  1410. }).then(() => {
  1411. //商品判断是否需要调用删除接口
  1412. if (row.id) {
  1413. corpsattn(row.id).then(res => {
  1414. this.$message({
  1415. type: "success",
  1416. message: "操作成功!"
  1417. });
  1418. this.goodsShowData.splice(index, 1);
  1419. // 删除时主表积分跟着改变
  1420. if (this.goodsActives == 'goods') {
  1421. this.form.presenterIntegral = 0;
  1422. this.goodsShowData.forEach(item => {
  1423. this.form.presenterIntegral = (Number(this.form.presenterIntegral) + Number(item.integral)).toFixed(2)
  1424. })
  1425. } else {
  1426. this.form.convertIntegral = 0;
  1427. this.goodsShowData.forEach(item => {
  1428. this.form.convertIntegral = (Number(this.form.convertIntegral) + Number(item.integral)).toFixed(2)
  1429. })
  1430. }
  1431. })
  1432. } else {
  1433. this.$message({
  1434. type: "success",
  1435. message: "操作成功!"
  1436. });
  1437. this.goodsShowData.splice(index, 1);
  1438. // 删除时主表积分跟着改变
  1439. if (this.goodsActives == 'goods') {
  1440. this.form.presenterIntegral = 0;
  1441. this.goodsShowData.forEach(item => {
  1442. this.form.presenterIntegral = (Number(this.form.presenterIntegral) + Number(item.integral)).toFixed(2)
  1443. })
  1444. } else {
  1445. this.form.convertIntegral = 0;
  1446. this.goodsShowData.forEach(item => {
  1447. this.form.convertIntegral = (Number(this.form.convertIntegral) + Number(item.integral)).toFixed(2)
  1448. })
  1449. }
  1450. }
  1451. })
  1452. },
  1453. //新增费用明细保存触发
  1454. rowSaveProject(row, done, loading) {
  1455. // this.advantageProjectData.push(row)
  1456. done()
  1457. },
  1458. //修改费用明细触发
  1459. rowUpdateProject(row, index, done, loading) {
  1460. done(row);
  1461. },
  1462. goodsSearch(params, done) {
  1463. this.treeDeptId = '';
  1464. this.onLoad(this.page, params);
  1465. done()
  1466. },
  1467. //商品列表查询
  1468. onLoad(page, params = {}) {
  1469. this.loading = true;
  1470. getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId).then(res => {
  1471. const data = res.data.data;
  1472. this.page.total = data.total;
  1473. this.data = data.records;
  1474. this.loading = false;
  1475. });
  1476. },
  1477. // 费用查询按钮
  1478. feesSearch(params, done) {
  1479. this.treeDeptIdCost = '';
  1480. this.onLoadCost(this.pageCost, params)
  1481. done()
  1482. },
  1483. //费用查询
  1484. onLoadCost(page, params = {}) {
  1485. this.loadingCost = true;
  1486. let queryParams = Object.assign({}, params, {
  1487. pageSize: page.pageSize,
  1488. pageNum: page.currentPage,
  1489. parentId: 0,
  1490. feesTypeId: this.treeDeptIdCost
  1491. })
  1492. customerList(queryParams).then(res => {
  1493. const data = res.data.data;
  1494. this.pageCost.total = data.total;
  1495. this.dataCost = data.records;
  1496. this.loadingCost = false;
  1497. });
  1498. },
  1499. //删除费用明细触发
  1500. rowDelProject(row, index, donerowDel) {
  1501. this.$confirm("确定将选择数据删除?", {
  1502. confirmButtonText: "确定",
  1503. cancelButtonText: "取消",
  1504. type: "warning"
  1505. }).then(() => {
  1506. //费用判断是否需要调用删除接口
  1507. if (row.id) {
  1508. corpsitem(row.id).then(res => {
  1509. this.$message({
  1510. type: "success",
  1511. message: "操作成功!"
  1512. });
  1513. this.advantageProjectData.splice(index, 1);
  1514. })
  1515. } else {
  1516. this.$message({
  1517. type: "success",
  1518. message: "操作成功!"
  1519. });
  1520. this.advantageProjectData.splice(index, 1);
  1521. }
  1522. })
  1523. },
  1524. //新增附件上传保存触发
  1525. rowSaveBankOfDeposit(row, done, loading) {
  1526. this.bankOfDepositData.push(row)
  1527. done()
  1528. },
  1529. //修改附件上传触发
  1530. rowUpdateBankOfDeposit(row, index, done, loading) {
  1531. done(row);
  1532. },
  1533. //删除附件上传触发
  1534. rowDelBankOfDeposit(row, index, donerowDel) {
  1535. this.$confirm("确定将选择数据删除?", {
  1536. confirmButtonText: "确定",
  1537. cancelButtonText: "取消",
  1538. type: "warning"
  1539. }).then(() => {
  1540. //附件判断是否需要调用删除接口
  1541. if (row.id) {
  1542. corpsbank(row.id).then(res => {
  1543. this.$message({
  1544. type: "success",
  1545. message: "操作成功!"
  1546. });
  1547. this.bankOfDepositData.splice(index, 1);
  1548. })
  1549. } else {
  1550. this.$message({
  1551. type: "success",
  1552. message: "操作成功!"
  1553. });
  1554. this.bankOfDepositData.splice(index, 1);
  1555. }
  1556. })
  1557. },
  1558. uploadAfter(res, done) {
  1559. if (res.originalName) {
  1560. this.bankOfDepositForm.fileName = this.bankOfDepositForm.fileName
  1561. ? this.bankOfDepositForm.fileName
  1562. : res.originalName;
  1563. }
  1564. done();
  1565. },
  1566. // 去重
  1567. removeRepeat() {
  1568. let obj = []
  1569. this.configuration.dicData = this.configuration.dicData.reduce((current,next) => {
  1570. obj[next.id] ? '': obj[next.id] = true && current.push(next)
  1571. return current
  1572. }, [])
  1573. },
  1574. //
  1575. receiveList(data){
  1576. this.configuration.dicData = this.configuration.dicData.concat(data)
  1577. this.removeRepeat()
  1578. },
  1579. //修改提交触发
  1580. editCustomer(isBack = false, type) {
  1581. this.$refs["form"].validate((valid) => {
  1582. if (valid) {
  1583. //商品信息
  1584. this.contactsData.forEach(item => {
  1585. this.$set(item, 'contractAmount', item.deliveryAmount)
  1586. })
  1587. if (this.goodsShowData.findIndex(item => item.goodType == 0) == -1) {
  1588. this.form.deliveryItemsList = this.goodsShowData.concat(this.contactsData)
  1589. } else {
  1590. this.form.deliveryItemsList = this.goodsShowData.concat(this.giftData)
  1591. }
  1592. this.form.deliveryItemsList.forEach(item => {
  1593. if (item.orderNo) {
  1594. this.$set(item, 'contractNumber', item.orderNo)
  1595. this.$set(item, 'srcOrderNo', item.orderNo)
  1596. }
  1597. this.$set(item, 'contractAmount', item.deliveryAmount)
  1598. })
  1599. this.form.deliveryItemsList = this.contactsData.concat(this.giftData)
  1600. // this.form.deliveryFeesList = this.advantageProjectData
  1601. this.form.deliveryFeesList = this.$refs.feeInfo.submitData()
  1602. this.form.deliveryFilesList = this.bankOfDepositData
  1603. if (typeof this.form.corpsTypeId == 'object') {
  1604. this.form.corpsTypeId = this.form.corpsTypeId.join(",")
  1605. }
  1606. this.saveLoading = true
  1607. this.form.billType = 'FH'
  1608. typeSave(this.form).then(res => {
  1609. this.$message({type: "success", message: this.form.id ? "修改成功!" : "新增成功!"});
  1610. // this.disabled = false
  1611. if (isBack) {
  1612. //成功关闭此页面回到列表页
  1613. this.$emit("goBack");
  1614. } else {
  1615. this.saveActives = ''
  1616. this.queryData(res.data.data.id, false, type)
  1617. }
  1618. }).catch(() => {
  1619. this.saveLoading = false
  1620. })
  1621. } else {
  1622. return false;
  1623. }
  1624. });
  1625. },
  1626. //复制新单
  1627. copyOrder() {
  1628. this.queryData(this.form.id, true)
  1629. },
  1630. //返回列表
  1631. backToList() {
  1632. let getGoodsList = []
  1633. let getGiftList = []
  1634. let getFeeList = this.$refs.feeInfo.submitData()
  1635. if (this.goodsShowData.findIndex(item => item.goodType == 0) == -1) {
  1636. getGiftList = this.goodsShowData
  1637. getGoodsList = this.contactsData
  1638. } else {
  1639. getGoodsList = this.goodsShowData
  1640. getGiftList = this.giftData
  1641. }
  1642. if (contrastObj(this.form, this.oldForm) ||
  1643. contrastList(getGoodsList, this.oldGoodsList) ||
  1644. contrastList(getGiftList, this.oldGiftList) ||
  1645. contrastList(getFeeList, this.oldFeesList) ||
  1646. contrastList(this.bankOfDepositData, this.oldUploadList)
  1647. ) {
  1648. this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
  1649. confirmButtonText: "确定",
  1650. cancelButtonText: "取消",
  1651. type: "warning"
  1652. }).then(() => {
  1653. this.editCustomer(true)
  1654. }).catch(() => {
  1655. this.$emit("goBack");
  1656. })
  1657. } else {
  1658. this.$emit("goBack");
  1659. }
  1660. },
  1661. // 确认发货
  1662. sendOutGoods() {
  1663. this.$refs["form"].validate((valid) => {
  1664. if (valid) {
  1665. if (this.contactsData.length == 0) {
  1666. return this.$message.error('商品信息为空')
  1667. }
  1668. let getGoodsList = []
  1669. let getGiftList = []
  1670. let getFeeList = this.$refs.feeInfo.submitData()
  1671. if (this.goodsShowData.findIndex(item => item.goodType == 0) == -1) {
  1672. getGiftList = this.goodsShowData
  1673. getGoodsList = this.contactsData
  1674. } else {
  1675. getGoodsList = this.goodsShowData
  1676. getGiftList = this.giftData
  1677. }
  1678. if (contrastObj(this.form, this.oldForm) ||
  1679. contrastList(getGoodsList, this.oldGoodsList) ||
  1680. contrastList(getGiftList, this.oldGiftList) ||
  1681. contrastList(getFeeList, this.oldFeesList) ||
  1682. contrastList(this.bankOfDepositData, this.oldUploadList)
  1683. ) {
  1684. this.$confirm("数据发生变化未有提交记录, 是否保存?", "提示", {
  1685. confirmButtonText: "确定",
  1686. cancelButtonText: "取消",
  1687. type: "warning"
  1688. }).then(async () => {
  1689. await this.editCustomer(false, '发货')
  1690. }).catch(() => {
  1691. this.$message.info('已取消')
  1692. })
  1693. } else {
  1694. //商品信息
  1695. if (this.goodsShowData.findIndex(item => item.goodType == 0) == -1) {
  1696. this.form.deliveryItemsList = this.goodsShowData.concat(this.contactsData)
  1697. } else {
  1698. this.form.deliveryItemsList = this.goodsShowData.concat(this.giftData)
  1699. }
  1700. this.form.deliveryFeesList = this.$refs.feeInfo.submitData()
  1701. this.form.deliveryFilesList = this.bankOfDepositData
  1702. if (typeof this.form.corpsTypeId == 'object') {
  1703. this.form.corpsTypeId = this.form.corpsTypeId.join(",")
  1704. }
  1705. this.pageLoading = true
  1706. this.saveActives = ''
  1707. sendOutGoods(this.form).then(res => {
  1708. this.$message.success('发货成功')
  1709. this.queryData(res.data.data.id)
  1710. }).finally(() => {
  1711. this.pageLoading = false
  1712. })
  1713. }
  1714. } else {
  1715. return false;
  1716. }
  1717. });
  1718. },
  1719. // 撤销发货
  1720. revokeOutGoods() {
  1721. this.$refs["form"].validate((valid) => {
  1722. if (valid) {
  1723. //商品信息
  1724. if (this.goodsShowData.findIndex(item => item.goodType == 0) == -1) {
  1725. this.form.deliveryItemsList = this.goodsShowData.concat(this.contactsData)
  1726. } else {
  1727. this.form.deliveryItemsList = this.goodsShowData.concat(this.giftData)
  1728. }
  1729. this.form.deliveryFeesList = this.$refs.feeInfo.submitData()
  1730. this.form.deliveryFilesList = this.bankOfDepositData
  1731. if (typeof this.form.corpsTypeId == 'object') {
  1732. this.form.corpsTypeId = this.form.corpsTypeId.join(",")
  1733. }
  1734. this.pageLoading = true
  1735. this.saveActives = ''
  1736. revokeOutGoods(this.form).then(res => {
  1737. this.$message.success('撤销成功')
  1738. this.queryData(res.data.data.id)
  1739. }).finally(() => {
  1740. this.pageLoading = false
  1741. })
  1742. } else {
  1743. return false;
  1744. }
  1745. });
  1746. },
  1747. // 确认到货
  1748. confirmArrival() {
  1749. let getGoodsList = []
  1750. let getGiftList = []
  1751. let getFeeList = this.$refs.feeInfo.submitData()
  1752. if (this.goodsShowData.findIndex(item => item.goodType == 0) == -1) {
  1753. getGiftList = this.goodsShowData
  1754. getGoodsList = this.contactsData
  1755. } else {
  1756. getGoodsList = this.goodsShowData
  1757. getGiftList = this.giftData
  1758. }
  1759. if (contrastObj(this.form, this.oldForm) ||
  1760. contrastList(getGoodsList, this.oldGoodsList) ||
  1761. contrastList(getGiftList, this.oldGiftList) ||
  1762. contrastList(getFeeList, this.oldFeesList) ||
  1763. contrastList(this.bankOfDepositData, this.oldUploadList)
  1764. ) {
  1765. this.$confirm("数据发生变化未有提交记录, 是否保存?", "提示", {
  1766. confirmButtonText: "确定",
  1767. cancelButtonText: "取消",
  1768. type: "warning"
  1769. }).then(() => {
  1770. this.editCustomer(false, '到货')
  1771. }).catch(() => {
  1772. this.$message.info('已取消')
  1773. })
  1774. } else {
  1775. if (this.goodsShowData.findIndex(item => item.goodType == 0) == -1) {
  1776. this.form.deliveryItemsList = this.goodsShowData.concat(this.contactsData)
  1777. } else {
  1778. this.form.deliveryItemsList = this.goodsShowData.concat(this.giftData)
  1779. }
  1780. this.pageLoading = true
  1781. this.saveActives = ''
  1782. confirmArrival(this.form).then(res => {
  1783. this.$message.success('已确认到货')
  1784. this.queryData(this.form.id)
  1785. }).catch(() => {
  1786. this.pageLoading = false
  1787. })
  1788. }
  1789. },
  1790. // 撤销到货
  1791. cancelArrival() {
  1792. if (this.goodsShowData.findIndex(item => item.goodType == 0) == -1) {
  1793. this.form.deliveryItemsList = this.goodsShowData.concat(this.contactsData)
  1794. } else {
  1795. this.form.deliveryItemsList = this.goodsShowData.concat(this.giftData)
  1796. }
  1797. this.pageLoading = true
  1798. this.saveActives = ''
  1799. cancelArrival(this.form).then(res => {
  1800. this.$message.success('撤销到货成功')
  1801. this.queryData(this.form.id)
  1802. }).catch(() => {
  1803. this.pageLoading = false
  1804. })
  1805. },
  1806. // 导入销售明细
  1807. importMarket(list) {
  1808. list.forEach(item => {
  1809. item.cname = item.cname
  1810. this.$set(item, 'specificationAndModel', item.itemType)
  1811. if (this.goodsActives == 'goods') {
  1812. this.$set(item, 'deliveryAmount', item.amount)
  1813. } else {
  1814. this.$set(item, 'deliveryAmount', 0)
  1815. }
  1816. this.$set(item, 'actualQuantity', item.orderQuantity)
  1817. this.$set(item, 'inventoryNumber', item.storageQuantity)
  1818. this.$set(item, 'integral', 0)
  1819. this.$set(item, 'orgOrderNo', this.form.orgOrderNo)
  1820. this.$set(item, 'srcOrderNo', this.form.srcOrderNo)
  1821. this.$set(item, 'arrivalQuantity', item.actualQuantity)
  1822. this.$set(item, "srcId", item.id)
  1823. if (this.goodsActives == "goods") {
  1824. this.$set(item, 'goodType', 0)
  1825. } else {
  1826. this.$set(item, 'goodType', 1)
  1827. }
  1828. delete item.id
  1829. delete item.createTime
  1830. delete item.createUser
  1831. delete item.pid
  1832. this.arrivalQuantityChange(item)
  1833. this.$refs.crudContact.rowCellAdd(item);
  1834. this.arrivalQuantityChange(item)
  1835. })
  1836. this.marketDialog = false;
  1837. },
  1838. // 关闭销售弹窗
  1839. closeMarkeDialog() {
  1840. this.marketDialog = false;
  1841. },
  1842. // 保存列设置
  1843. async saveColumn(name) {
  1844. if (name == 'goods') {
  1845. const inSave = await this.saveColumnData(
  1846. this.getColumnName(21),
  1847. this.customerContact
  1848. );
  1849. if (inSave) {
  1850. this.$message.success("保存成功");
  1851. //关闭窗口
  1852. this.$refs.crudContact.$refs.dialogColumn.columnBox = false;
  1853. }
  1854. } else if (name === 'fees') {
  1855. const inSave = await this.saveColumnData(
  1856. this.getColumnName(22),
  1857. this.advantageProject
  1858. );
  1859. if (inSave) {
  1860. this.$message.success("保存成功");
  1861. //关闭窗口
  1862. this.$refs.crudProject.$refs.dialogColumn.columnBox = false;
  1863. }
  1864. }
  1865. },
  1866. async resetColumn() {
  1867. const inSave = await this.delColumnData(
  1868. this.getColumnName(21),
  1869. customerContact
  1870. );
  1871. if (inSave) {
  1872. this.$message.success("重置成功");
  1873. //关闭窗口
  1874. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  1875. }
  1876. },
  1877. // 商品表格加色
  1878. goodsRowClassName({row, column, rowIndex, columnIndex}) {
  1879. if (Number(row.actualQuantity) > Number(row.inventoryNumber) && column.property == 'inventoryNumber') {
  1880. return "color: #fff;background:#a4cf57"
  1881. }
  1882. return '';
  1883. },
  1884. // 库存刷新
  1885. resetStock() {
  1886. this.contactsData.forEach(item => {
  1887. selectGoodsNum({
  1888. goodsId: item.itemId,
  1889. itemType: item.itemType? item.itemType: item.typeno,
  1890. tradeType: 'GN',
  1891. storageId: this.form.storageId
  1892. }).then(res => {
  1893. item.inventoryNumber = res.data.data
  1894. })
  1895. })
  1896. this.$message.success('刷新成功')
  1897. },
  1898. // 商品信息标签页切换
  1899. handleClick(data) {
  1900. if (this.saveActives == data.name) return
  1901. this.saveActives = data.name
  1902. this.goodsDisabled = true
  1903. if (data.name == 'goods') {
  1904. this.giftData = this.goodsShowData
  1905. // 显示
  1906. this.customerContact.column.forEach(item => {
  1907. if (item.prop == 'integralMultiples') item.label = '积分倍数'
  1908. if (item.prop == 'integral') item.label = '赠送积分'
  1909. if (item.prop == 'actualQuantity') item.label = '出库数量'
  1910. if (item.prop == 'priceType' || item.prop == 'code' || item.prop == 'typeno' || item.prop == 'corpId'
  1911. || item.prop == 'packageRemarks' || item.prop == 'invoiceWeight'
  1912. || item.prop == 'inventoryNumber' || item.prop == 'inventoryAmount'
  1913. || item.prop == 'arrivalQuantity'
  1914. ) {
  1915. item.hide = false;
  1916. item.showColumn = true;
  1917. }
  1918. })
  1919. this.goodsShowData = this.contactsData;
  1920. setTimeout(() => {
  1921. this.goodsDisabled = false
  1922. },500)
  1923. } else {
  1924. // 隐藏字段
  1925. this.contactsData = this.goodsShowData
  1926. this.customerContact.column.forEach(item => {
  1927. if (item.prop == 'integralMultiples') item.label = '积分单价'
  1928. if (item.prop == 'integral') item.label = '兑换积分'
  1929. if (item.prop == 'actualQuantity') item.label = '数量'
  1930. if (item.prop == 'priceType' || item.prop == 'code' || item.prop == 'typeno' || item.prop == 'corpId'
  1931. || item.prop == 'packageRemarks' || item.prop == 'invoiceWeight' || item.prop == 'inventoryNumber'
  1932. || item.prop == 'inventoryAmount' || item.prop == 'arrivalQuantity'
  1933. ) {
  1934. item.hide = true;
  1935. item.showColumn = false;
  1936. }
  1937. })
  1938. this.goodsShowData = this.giftData;
  1939. setTimeout(() => {
  1940. this.goodsDisabled = false
  1941. },500)
  1942. }
  1943. },
  1944. // 报表
  1945. openReport() {
  1946. this.switchDialog =! this.switchDialog;
  1947. },
  1948. onClose(val) {
  1949. this.switchDialog = val;
  1950. },
  1951. }
  1952. }
  1953. </script>
  1954. <style lang="scss" scoped>
  1955. //.customer-head {
  1956. // position: fixed;
  1957. // top: 105px;
  1958. // width: 100%;
  1959. // margin-left: -10px;
  1960. // height: 62px;
  1961. // background: #ffffff;
  1962. // box-shadow: 0 4px 12px 0px rgba(232, 232, 235, 1);
  1963. // z-index: 999;
  1964. //}
  1965. //
  1966. //.customer-back {
  1967. // cursor: pointer;
  1968. // line-height: 62px;
  1969. // font-size: 16px;
  1970. // color: #323233;
  1971. // font-weight: 400;
  1972. //}
  1973. .back-icon {
  1974. line-height: 64px;
  1975. font-size: 20px;
  1976. margin-right: 8px;
  1977. }
  1978. //.add-customer-btn {
  1979. // position: fixed;
  1980. // right: 36px;
  1981. // top: 115px;
  1982. //}
  1983. ::v-deep .el-form-item {
  1984. margin-bottom: 0;
  1985. }
  1986. .el-dialogDeep {
  1987. ::v-deep .el-dialog {
  1988. margin: 1vh auto 0 !important;
  1989. padding-bottom: 10px !important;
  1990. .el-dialog__body, .el-dialog__footer {
  1991. padding-bottom: 0 !important;
  1992. padding-top: 0 !important;
  1993. }
  1994. }
  1995. }
  1996. .print-div {
  1997. color: #000;
  1998. }
  1999. .print_table {
  2000. table {
  2001. border-right: 1px solid #000;
  2002. border-bottom: 1px solid #000;
  2003. font-size: 12px;
  2004. margin-bottom: 5px;
  2005. }
  2006. table td {
  2007. border-left: 1px solid #000;
  2008. border-top: 1px solid #000;
  2009. vertical-align: middle;
  2010. padding: 2px;
  2011. text-align: center;
  2012. }
  2013. }
  2014. .table {
  2015. border-collapse: collapse;
  2016. border-spacing: 0;
  2017. background-color: transparent;
  2018. display: table;
  2019. width: 99%;
  2020. max-width: 100%;
  2021. margin: 0 auto;
  2022. }
  2023. .table td {
  2024. text-align: left;
  2025. vertical-align: middle;
  2026. font-size: 14px;
  2027. color: #000000;
  2028. padding: 10.5px 0 10.5px 30px;
  2029. //border: 1px solid #000;
  2030. }
  2031. ::v-deep .el-form-item {
  2032. margin-bottom: 0;
  2033. }
  2034. ::v-deep .el-form-item__content{
  2035. line-height: 32px;
  2036. }
  2037. </style>