detailsPageEdit.vue 79 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418
  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="warning"
  20. :disabled="detailData.seeDisabled"
  21. size="small"
  22. @click="applySettlement('收费')"
  23. >生成账单</el-button>
  24. <el-button
  25. class="el-button--small-yh"
  26. type="warning"
  27. :disabled="detailData.seeDisabled"
  28. size="small"
  29. @click="applySettlement('申请')"
  30. >退款</el-button>
  31. <el-button
  32. class="el-button--small-yh"
  33. type="primary"
  34. :disabled="detailData.seeDisabled"
  35. size="small"
  36. @click="saveSell"
  37. >生成采购单</el-button>
  38. <el-button
  39. class="el-button--small-yh"
  40. type="success" @click="copyOrder"
  41. size="small"
  42. :disabled="detailData.seeDisabled || !this.form.id">
  43. 复制新单
  44. </el-button>
  45. <el-button
  46. class="el-button--small-yh"
  47. type="primary"
  48. :disabled="disabled || detailData.seeDisabled"
  49. :loading="saveLoading"
  50. size="small"
  51. @click="editCustomer(false)"
  52. >{{ form.id ? '确认修改' : '确认新增' }}
  53. </el-button>
  54. </div>
  55. </div>
  56. <div class="customer-main">
  57. <el-form :model="form" ref="form" label-width="130px" class="demo-ruleForm">
  58. <containerTitle title="基础资料"></containerTitle>
  59. <basic-container style="margin-bottom: 10px">
  60. <el-row>
  61. <el-col v-for="(item,index) in basicData.column" :key="index" :span="item.span?item.span:8">
  62. <el-form-item :label="item.label" :prop="item.prop" :rules="item.rules">
  63. <el-date-picker v-if="item.type === 'datetime'" style="width: 100%;" v-model="form[item.prop]"
  64. size="small" type="datetime" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss" :disabled="detailData.seeDisabled"/>
  65. <el-date-picker v-else-if="item.type === 'date'" style="width: 100%;" v-model="form[item.prop]"
  66. size="small" type="date" placeholder="选择日期"
  67. value-format="yyyy-MM-dd HH:mm:ss"
  68. :disabled="detailData.seeDisabled"/>
  69. <selectComponent v-else-if="item.prop === 'corpId'" v-model="form[item.prop]"
  70. :configuration="configuration" style="width: 100%" :disabled="detailData.seeDisabled"
  71. @getRow="getCorpRow"
  72. />
  73. <!-- 所属公司带出银行信息-->
  74. <selectComponent v-else-if="item.prop === 'belongToCorpId'"
  75. v-model="form[item.prop]" :configuration="companyConfiguration"
  76. style="width: 100%"
  77. :disabled="detailData.seeDisabled"
  78. @returnBack="returnBack"/>
  79. <!-- 生产工厂-->
  80. <selectComponent v-else-if="item.prop === 'productionPlant'"
  81. v-model="form[item.prop]" :configuration="plantConfiguration"
  82. style="width: 100%"
  83. :disabled="detailData.seeDisabled"
  84. @getRow="getPlantRow"/>
  85. <el-select v-else-if="item.prop === 'paymentType'" v-model="form[item.prop]" placeholder="请选择" clearable filterable style="width: 100%" size="small" :disabled="detailData.seeDisabled">
  86. <el-option v-for="(item,index) in paymentOption" :key="index" :label="item.dictValue" :value="item.dictValue"></el-option>
  87. </el-select>
  88. <el-select v-else-if="item.prop === 'banks'"
  89. v-model="form[item.prop]" placeholder="请选择"
  90. clearable
  91. filterable
  92. allow-create
  93. default-first-option
  94. size="small"
  95. style="width: 100%;"
  96. @change="banksChange"
  97. :disabled="detailData.seeDisabled">
  98. <el-option v-for="(item,index) in bankList" :key="index" :label="item.accountNo" :value="item.accountNo"></el-option>
  99. </el-select>
  100. <el-input
  101. v-else-if="item.type == 'number'"
  102. placeholder="请输入"
  103. v-input-limit="2"
  104. size="small"
  105. :disabled="item.disabled || detailData.seeDisabled"
  106. v-model.trim="form[item.prop]"
  107. />
  108. <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"></el-input>
  109. <el-input type="age" v-else v-model.trim="form[item.prop]" size="small" autocomplete="off" :disabled="item.disabled || detailData.seeDisabled" clearable></el-input>
  110. </el-form-item>
  111. </el-col>
  112. </el-row>
  113. </basic-container>
  114. <containerTitle title="发货信息"></containerTitle>
  115. <basic-container style="margin-bottom: 10px">
  116. <el-row>
  117. <el-col v-for="(item,index) in contactInformation.column" :key="index" :span="item.span?item.span:8">
  118. <el-form-item :label="item.label" :prop="item.prop" :rules="item.rules">
  119. <el-date-picker v-if="item.type === 'datetime'" style="width: 100%;" v-model="form[item.prop]" size="small" type="datetime" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss" :disabled="item.disabled || detailData.seeDisabled"/>
  120. <el-date-picker v-else-if="item.type === 'date'" style="width: 100%;" v-model="form[item.prop]"
  121. size="small" type="date" placeholder="选择日期"
  122. value-format="yyyy-MM-dd HH:mm:ss"
  123. :disabled="detailData.seeDisabled"/>
  124. <el-input
  125. v-else-if="(item.prop === 'advancePayment') || (item.prop === 'settlmentAmount') || (item.prop === 'overPayment')"
  126. v-model.trim="form[item.prop]" size="small" autocomplete="off"
  127. @change="computedCost"
  128. :disabled="detailData.seeDisabled"
  129. v-input-limit="2"
  130. ></el-input>
  131. <el-select v-else-if="item.prop === 'orderStatus'" v-model="form[item.prop]" placeholder="请选择" clearable filterable style="width: 100%" size="small" :disabled="detailData.seeDisabled">
  132. <el-option v-for="(item,index) in statusOption" :key="index" :label="item.dictValue" :value="item.dictValue"></el-option>
  133. </el-select>
  134. <el-input type="age" v-else-if="item.prop === 'grossProfitRate'" v-model.trim="form[item.prop]" size="small" autocomplete="off" placeholder="请输入" :disabled="detailData.seeDisabled" v-input-limit="2">
  135. <template slot="append">%</template>
  136. </el-input>
  137. <el-input
  138. v-else-if="item.type == 'number'"
  139. placeholder="请输入"
  140. v-input-limit="2"
  141. size="small"
  142. :disabled="item.disabled || detailData.seeDisabled"
  143. v-model.trim="form[item.prop]"
  144. />
  145. <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"></el-input>
  146. <el-input v-else type="age" v-model.trim="form[item.prop]" size="small" autocomplete="off" :disabled="item.disabled || detailData.seeDisabled"></el-input>
  147. </el-form-item>
  148. </el-col>
  149. </el-row>
  150. </basic-container>
  151. <containerTitle title="商品信息"></containerTitle>
  152. <basic-container style="margin-bottom: 10px">
  153. <avue-crud
  154. :option="customerContact"
  155. v-model="contactsForm"
  156. :data="contactsData"
  157. ref="crudContact"
  158. @row-save="rowSave"
  159. @row-click="handleRowClick"
  160. @row-update="rowUpdate"
  161. @selection-change="productSelection"
  162. @row-del="rowDel"
  163. @saveColumn="saveColumn('goods')"
  164. >
  165. <template slot="corpId" slot-scope="{ row, index }">
  166. <customer-dialog
  167. v-if="row.$cellEdit"
  168. v-model="row.corpName"
  169. :cropIndex="index"
  170. @getcorpId="getcorpId"
  171. ></customer-dialog>
  172. <span v-else>{{ row.corpName }}</span>
  173. </template>
  174. <template slot="code" slot-scope="{row,index}">
  175. <el-button
  176. type="text"
  177. size="mini"
  178. style="padding:4px 10px;float:left"
  179. @click="commodityChoice(row)"
  180. :disabled="detailData.seeDisabled || !row.$cellEdit">选择</el-button>
  181. <span>{{ row.code }}</span>
  182. </template>
  183. <template slot="purchaseAmount" slot-scope="{ row }">
  184. <el-select
  185. v-if="row.$cellEdit"
  186. v-model="row.purchaseAmount"
  187. @focus="getPurchasePrice(row)"
  188. allow-create
  189. filterable
  190. v-input-limit="2"
  191. >
  192. <el-option
  193. v-for="(item, index) in purchasePriceOption"
  194. :key="index"
  195. :label="item.purchasePrice"
  196. :value="item.purchasePrice"></el-option>
  197. </el-select>
  198. <span v-else>{{ row.purchaseAmount }}</span>
  199. </template>
  200. <template slot="price" slot-scope="{ row }">
  201. <el-select
  202. v-if="row.$cellEdit"
  203. v-model="row.price"
  204. @focus="getMarketPrice(row)"
  205. @input="priceChange(row)"
  206. allow-create
  207. filterable
  208. v-input-limit="2"
  209. >
  210. <el-option
  211. v-for="(item, index) in salesPriceOtion"
  212. :key="index"
  213. :label="item.salesPrice"
  214. :value="item.salesPrice"></el-option>
  215. </el-select>
  216. <span v-else>{{ row.price }}</span>
  217. </template>
  218. <template slot="orderQuantity" slot-scope="{ row }">
  219. <el-input
  220. v-if="row.$cellEdit"
  221. v-model.trim="row.orderQuantity"
  222. oninput='this.value=this.value.replace(/[^\-?\d.]/g,"").replace(/^(\-)*(\d+)\.(\d\d).*$/, "$1$2.$3")'
  223. size="small"
  224. @input="quantityChange(row)"
  225. ></el-input>
  226. <span v-else>{{ row.orderQuantity }}</span>
  227. </template>
  228. <template slot="cname" slot-scope="{ row }">
  229. <goods-select v-if="row.$cellEdit" v-model="row.cname" @getRow="getGoodsRow($event, row)"
  230. :configuration="goodsConfiguration" @receiveList="receiveGoodList" @returnRow="getRow($event, row)"/>
  231. <span v-else>
  232. <span v-for="item in goodsConfiguration.dicData" v-if="item.cname == row.cname">{{ item.cname }}</span>
  233. </span>
  234. </template>
  235. <template slot-scope="{row,index}" slot="menu">
  236. <el-button
  237. type="text"
  238. size="small"
  239. @click="rowCell(row,index)"
  240. :disabled="detailData.seeDisabled"
  241. >{{ row.$cellEdit ? '保 存' : '修 改' }}
  242. </el-button>
  243. <el-button
  244. size="small"
  245. icon="el-icon-delete"
  246. type="text"
  247. @click="rowDel(row, index)"
  248. :disabled="detailData.seeDisabled"
  249. v-if="!row.$cellEdit"
  250. >删 除</el-button>
  251. </template>
  252. <template slot="menuLeft" slot-scope="{size}">
  253. <el-button type="primary"
  254. icon="el-icon-plus"
  255. size="small"
  256. @click="commoditySelection"
  257. :disabled="detailData.seeDisabled">录入明细
  258. </el-button>
  259. <el-button type="primary"
  260. icon="el-icon-plus"
  261. size="small"
  262. @click="policy"
  263. :disabled="detailData.seeDisabled">政策
  264. </el-button>
  265. <el-button type="warning"
  266. icon="el-icon-plus"
  267. size="small"
  268. :disabled="selection.length < 1 || detailData.seeDisabled"
  269. @click="getShipmentD">生成发货单
  270. </el-button>
  271. <el-button type="info"
  272. :size="size"
  273. icon="el-icon-printer"
  274. :disabled="detailData.seeDisabled"
  275. @click.stop="openReport()"
  276. >报 表</el-button>
  277. <el-button
  278. type="primary"
  279. size="small"
  280. icon="el-icon-download"
  281. @click="downloadHandle"
  282. >下载模板</el-button>
  283. <el-upload
  284. :action="baseURL"
  285. :headers="headers"
  286. :disabled="detailData.seeDisabled"
  287. :on-progress="uploading"
  288. :show-file-list=false
  289. accept=".xls,.xlsx"
  290. multiple
  291. :on-success="importTemplate"
  292. style="float: right"
  293. >
  294. <el-button
  295. type="primary"
  296. size="small"
  297. icon="el-icon-upload"
  298. >导 入</el-button>
  299. </el-upload>
  300. </template>
  301. </avue-crud>
  302. </basic-container>
  303. <containerTitle title="费用明细"></containerTitle>
  304. <basic-container style="margin-bottom: 10px">
  305. <avue-crud
  306. :option="advantageProject"
  307. v-model="advantageProjectForm"
  308. :data="advantageProjectData"
  309. ref="crudProject"
  310. @row-save="rowSaveProject"
  311. @row-update="rowUpdateProject"
  312. @row-del="rowDelProject"
  313. @saveColumn="saveColumn('fees')"
  314. >
  315. <template slot="code" slot-scope="{row,index}">
  316. <el-button type="text" size="mini" style="padding:4px 10px;float:left" @click="choice(row)" :disabled="detailData.seeDisabled || !row.$cellEdit">选择</el-button>
  317. <span>{{ row.code }}</span>
  318. </template>
  319. <template slot="corpId" slot-scope="{ row }">
  320. <selectComponent v-if="row.$cellEdit" v-model="row.corpId"
  321. :configuration="configuration" @receiveList="receiveList"/>
  322. <span v-else>
  323. <span v-for="item in configuration.dicData" v-if="item.id == row.corpId">{{ item.cname }}</span>
  324. </span>
  325. </template>
  326. <template slot="amount" slot-scope="{ row }">
  327. <el-input v-if="row.$cellEdit" v-model.trim="row.amount"
  328. size="small" v-input-limit="2"
  329. ></el-input>
  330. <span v-else>{{ row.amount }}</span>
  331. </template>
  332. <template slot="settlmentAmount" slot-scope="{ row }">
  333. <el-input v-if="row.$cellEdit" v-model.trim="row.settlmentAmount"
  334. size="small" v-input-limit="2"
  335. ></el-input>
  336. <span v-else>{{ row.settlmentAmount }}</span>
  337. </template>
  338. <template slot-scope="{row,index}" slot="menu">
  339. <el-button
  340. type="text"
  341. size="small"
  342. @click="rowCellTwo(row,index)"
  343. :disabled="detailData.seeDisabled"
  344. >{{ row.$cellEdit ? '保 存' : '修 改 ' }}
  345. </el-button>
  346. <el-button
  347. size="small"
  348. icon="el-icon-delete"
  349. type="text"
  350. @click="rowDelProject(row, index)"
  351. :disabled="detailData.seeDisabled"
  352. v-if="!row.$cellEdit"
  353. >删 除</el-button>
  354. </template>
  355. <template slot="menuLeft" slot-scope="{size}">
  356. <el-button type="primary"
  357. icon="el-icon-plus"
  358. size="small"
  359. @click="costIncrease"
  360. :disabled="detailData.seeDisabled"
  361. >录入明细
  362. </el-button>
  363. </template>
  364. </avue-crud>
  365. </basic-container>
  366. <containerTitle title="附件上传"></containerTitle>
  367. <basic-container style="margin-bottom: 40px">
  368. <avue-crud
  369. :option="bankOfDeposit"
  370. v-model="bankOfDepositForm"
  371. :data="bankOfDepositData"
  372. @row-save="rowSaveBankOfDeposit"
  373. @row-update="rowUpdateBankOfDeposit"
  374. @row-del="rowDelBankOfDeposit"
  375. :upload-after="uploadAfter"
  376. ref="uploadCrud"
  377. >
  378. <template slot="menuLeft">
  379. <el-button
  380. type="primary"
  381. icon="el-icon-plus"
  382. size="small"
  383. @click.stop="$refs.uploadCrud.rowAdd()"
  384. :disabled="detailData.seeDisabled"
  385. >上传</el-button
  386. >
  387. </template>
  388. <template slot="menu" slot-scope="{ row, index }">
  389. <el-button
  390. size="small"
  391. icon="el-icon-edit"
  392. type="text"
  393. @click="$refs.uploadCrud.rowEdit(row, index)"
  394. :disabled="detailData.seeDisabled"
  395. >编 辑</el-button
  396. >
  397. <el-button
  398. size="small"
  399. icon="el-icon-delete"
  400. type="text"
  401. @click="rowDelBankOfDeposit(row, index)"
  402. :disabled="detailData.seeDisabled"
  403. >删 除</el-button
  404. >
  405. </template>
  406. </avue-crud>
  407. </basic-container>
  408. </el-form>
  409. </div>
  410. <el-dialog
  411. title="导入商品"
  412. append-to-body
  413. class="el-dialogDeep"
  414. :visible.sync="dialogVisible"
  415. width="80%"
  416. :close-on-click-modal="false"
  417. :destroy-on-close="true"
  418. :close-on-press-escape="false"
  419. @close="closeGoods">
  420. <el-row :style="{height: rowHeight}">
  421. <el-col :span="5" style="height: 100%;overflow-y: auto">
  422. <div>
  423. <el-scrollbar>
  424. <basic-container>
  425. <avue-tree :option="treeOption" :data="treeDataGoods" @node-click="nodeClick"/>
  426. </basic-container>
  427. </el-scrollbar>
  428. </div>
  429. </el-col>
  430. <el-col :span="19">
  431. <basic-container>
  432. <avue-crud :option="optionTwo"
  433. :table-loading="loading"
  434. :data="data"
  435. ref="crud"
  436. @refresh-change="refreshChange"
  437. @selection-change="selectionChange"
  438. @search-change="goodsSearch"
  439. :page.sync="page"
  440. @on-load="onLoad"></avue-crud>
  441. </basic-container>
  442. </el-col>
  443. </el-row>
  444. <span slot="footer" class="dialog-footer">
  445. <el-button @click="dialogVisible = false">取 消</el-button>
  446. <el-button type="primary" @click="importGoods" v-if="commodityData !== true">导入</el-button>
  447. <el-button type="primary" @click="importChoice" v-if="commodityData === true"
  448. :disabled="tableData.length !== 1">导入</el-button>
  449. </span>
  450. </el-dialog>
  451. <el-dialog
  452. title="导入政策"
  453. append-to-body
  454. class="el-dialogDeep"
  455. :visible.sync="policyDialog"
  456. width="80%"
  457. :close-on-click-modal="false"
  458. :destroy-on-close="true"
  459. :close-on-press-escape="false"
  460. @close="closePolicy">
  461. <el-row :style="{height: rowHeight}">
  462. <el-col :span="5" style="height: 100%;overflow-y: auto">
  463. <div>
  464. <el-scrollbar>
  465. <basic-container>
  466. <avue-tree :option="policyOption" :data="treeDataPolicy" @node-click="policyNodeClick"/>
  467. </basic-container>
  468. </el-scrollbar>
  469. </div>
  470. </el-col>
  471. <el-col :span="19">
  472. <containerTitle title="特价促销"></containerTitle>
  473. <basic-container style="margin-bottom: 10px">
  474. <avue-crud :option="optionPolicy"
  475. :table-loading="loadingPolicy"
  476. :data="dataPolicy"
  477. ref="crud"
  478. @selection-change="selectionChangePolicy"
  479. :page.sync="pagePolicy">
  480. </avue-crud>
  481. </basic-container>
  482. <containerTitle title="买赠促销"></containerTitle>
  483. <basic-container>
  484. <avue-crud
  485. :option="customerBuyFree"
  486. :data="contactsDataBuyFree"
  487. @selection-change="selectionChangePolicyTwo"
  488. ref="crudContactE">
  489. </avue-crud>
  490. </basic-container>
  491. </el-col>
  492. </el-row>
  493. <span slot="footer" class="dialog-footer">
  494. <el-button @click="policyDialog = false">取 消</el-button>
  495. <el-button type="primary" @click="importPolicy">导入</el-button>
  496. </span>
  497. </el-dialog>
  498. <el-dialog
  499. title="导入费用"
  500. append-to-body
  501. class="el-dialogDeep"
  502. :visible.sync="dialogCost"
  503. width="80%"
  504. top="8vh"
  505. :close-on-click-modal="false"
  506. :destroy-on-close="true"
  507. :close-on-press-escape="false"
  508. @close="closeFees">
  509. <el-row :style="{height: rowHeight}">
  510. <el-col :span="5" style="height: 100%;overflow-y: auto">
  511. <div>
  512. <el-scrollbar>
  513. <basic-container>
  514. <avue-tree :option="treeOptionCost" :data="treeData" @node-click="nodeClickCost"/>
  515. </basic-container>
  516. </el-scrollbar>
  517. </div>
  518. </el-col>
  519. <el-col :span="19">
  520. <basic-container>
  521. <avue-crud :option="optionTwoCost"
  522. :table-loading="loadingCost"
  523. :data="dataCost"
  524. ref="crud"
  525. @refresh-change="refreshChangeCost"
  526. @selection-change="selectionChangeCost"
  527. :page.sync="pageCost"
  528. @search-change="feesSearch"
  529. @on-load="onLoadCost">
  530. </avue-crud>
  531. </basic-container>
  532. </el-col>
  533. </el-row>
  534. <span slot="footer" class="dialog-footer">
  535. <el-button @click="dialogCost = false">取 消</el-button>
  536. <el-button type="primary" @click="importCost" v-if="choiceData !== true">导入</el-button>
  537. <el-button type="primary" @click="choiceCost" v-if="choiceData === true"
  538. :disabled="tableDataCost.length !== 1">导入</el-button>
  539. </span>
  540. </el-dialog>
  541. <el-dialog
  542. title="账单"
  543. append-to-body
  544. class="el-dialogDeep"
  545. :visible.sync="applySettlementDialog"
  546. width="60%"
  547. :close-on-click-modal="false"
  548. :destroy-on-close="true"
  549. :close-on-press-escape="false"
  550. v-dialog-drag
  551. >
  552. <apply-payment
  553. :billType="billType"
  554. :billData="billData"
  555. @choceFun="choceFun"
  556. >
  557. </apply-payment>
  558. </el-dialog>
  559. <report-dialog
  560. :switchDialog="switchDialog"
  561. @onClose="onClose()"
  562. ></report-dialog>
  563. </div>
  564. </template>
  565. <script>
  566. import {
  567. typeSave, detail, deleteDetails,
  568. corpstypeTree,
  569. corpsattn,
  570. corpsbank,
  571. corpsfiles,
  572. corpsitem,
  573. getList,
  574. detailList,
  575. generateShipment,
  576. saveSell,
  577. getlistBankBy,
  578. } from "@/api/basicData/configuration"
  579. import {selectGoodsNum} from "@/api/basicData/inventoryAccount"
  580. import customerContact from "./configuration/customerContact.json"
  581. import advantageProject from "./configuration/advantageProject.json"
  582. import bankOfDeposit from "./configuration/bankOfDeposit.json"
  583. import commodity from "./configuration/commodity.json"
  584. import optionTwoCost from "./configuration/mainListCost.json"
  585. import optionPolicy from "./configuration/optionPolicy.json"
  586. import BuyFree from "./configuration/BuyFree.json"
  587. import {
  588. getDeptLazyTree,
  589. getDeptLazyTreeTwo,
  590. customerList,
  591. policyList,
  592. policyColumn
  593. } from "@/api/basicData/basicFeesDesc";
  594. import _ from "lodash";
  595. import option from "./configuration/mainList.json";
  596. import { contrastObj, contrastList } from "@/util/contrastData";
  597. import { getMarketPrice, getPurchasePrice } from "@/api/basicData/fees"
  598. import customerDialog from "@/components/customer-dialog/main";
  599. //账单组件
  600. import ApplyPayment from "../../../components/finance/applyPayment";
  601. import reportDialog from "@/components/report-dialog/main";
  602. import { getToken } from "@/util/auth";
  603. import Cookies from 'js-cookie'
  604. export default {
  605. name: "detailsPage",
  606. props: {
  607. detailData: {
  608. type: Object
  609. }
  610. },
  611. components:{
  612. customerDialog,
  613. ApplyPayment,
  614. reportDialog,
  615. },
  616. data() {
  617. return {
  618. saveLoading: false,
  619. disabled: false,
  620. form: {},
  621. billType:"收费", //账单类型
  622. billData:{}, //账单需要数据
  623. applySettlementDialog:false,//生成账单组件
  624. configuration: {
  625. multipleChoices: false,
  626. multiple: false,
  627. collapseTags: false,
  628. placeholder: '请点击右边按钮选择',
  629. dicData: []
  630. },
  631. goodsConfiguration: {
  632. multipleChoices: false,
  633. multiple: false,
  634. collapseTags: false,
  635. placeholder: '请点击右边按钮选择',
  636. dicData: []
  637. },
  638. plantConfiguration: {
  639. multipleChoices: false,
  640. multiple: false,
  641. collapseTags: false,
  642. placeholder: '请点击右边按钮选择',
  643. dicData: []
  644. },
  645. companyConfiguration: {
  646. multipleChoices: false,
  647. multiple: false,
  648. collapseTags: false,
  649. placeholder: '请点击右边按钮选择',
  650. dicData: []
  651. },
  652. data: [],
  653. policyForm: {},
  654. dataPolicy: [],
  655. contactsDataBuyFree: [],
  656. loadingCost: false,
  657. customerDivide: '',
  658. choiceData: false,
  659. commodityData: false,
  660. dataCost: [],
  661. treeDataPolicy: [],
  662. treeDataGoods: [],
  663. choiceIndex: '',
  664. dialogCost: false,
  665. treeDeptId: '',
  666. treeDeptIdCost: '',
  667. treePolicyId: '',
  668. pageCost: {
  669. pageSize: 10,
  670. currentPage: 1,
  671. total: 0
  672. },
  673. page: {
  674. pageSize: 10,
  675. currentPage: 1,
  676. total: 0
  677. },
  678. pagePolicy: {
  679. pageSize: 10,
  680. currentPage: 1,
  681. total: 0
  682. },
  683. loading: false,
  684. loadingPolicy: false,
  685. contactsForm: {},
  686. optionPolicy: optionPolicy,
  687. optionTwo: commodity,
  688. optionTwoCost: optionTwoCost,
  689. customerBuyFree: BuyFree,
  690. policyOption: {
  691. nodeKey: 'id',
  692. lazy: true,
  693. treeLoad: function (node, resolve) {
  694. const parentId = (node.level === 0) ? 0 : node.data.id;
  695. const newTime = new Date().toLocaleString('chinese',{hour12:false})
  696. policyColumn({newTime: newTime,parentId: parentId}).then(res => {
  697. resolve(res.data.data.map(item => {
  698. return {
  699. ...item,
  700. leaf: !item.hasChildren
  701. }
  702. }))
  703. });
  704. },
  705. addBtn: false,
  706. menu: false,
  707. size: 'small',
  708. props: {
  709. labelText: '标题',
  710. label: 'title',
  711. value: 'value',
  712. children: 'children'
  713. }
  714. },
  715. treeOptionCost: {
  716. nodeKey: 'id',
  717. lazy: true,
  718. treeLoad: function (node, resolve) {
  719. const parentId = (node.level === 0) ? 0 : node.data.id;
  720. getDeptLazyTree(parentId).then(res => {
  721. resolve(res.data.data.map(item => {
  722. return {
  723. ...item,
  724. leaf: !item.hasChildren
  725. }
  726. }))
  727. });
  728. },
  729. addBtn: false,
  730. menu: false,
  731. size: 'small',
  732. props: {
  733. labelText: '标题',
  734. label: 'title',
  735. value: 'value',
  736. children: 'children'
  737. }
  738. },
  739. treeOption: {
  740. nodeKey: 'id',
  741. lazy: true,
  742. treeLoad: function (node, resolve) {
  743. const parentId = (node.level === 0) ? 0 : node.data.id;
  744. getDeptLazyTreeTwo(parentId).then(res => {
  745. resolve(res.data.data.map(item => {
  746. return {
  747. ...item,
  748. leaf: !item.hasChildren
  749. }
  750. }))
  751. });
  752. },
  753. addBtn: false,
  754. menu: false,
  755. size: 'small',
  756. props: {
  757. labelText: '标题',
  758. label: 'title',
  759. value: 'value',
  760. children: 'children'
  761. }
  762. },
  763. dialogVisible: false,
  764. policyDialog: false,
  765. advantageProjectForm: {},
  766. selection: [],
  767. bankOfDepositForm: {},
  768. contactsData: [],
  769. advantageProjectData: [],
  770. bankOfDepositData: [],
  771. tableDataCost: [],
  772. dic: [],
  773. tableData: [],
  774. policyData: [],
  775. policyDataTwo: [],
  776. customerContact: {},
  777. advantageProject: {},
  778. bankOfDeposit: bankOfDeposit,
  779. contactInformation: {
  780. column: [
  781. {
  782. label: '销售金额',
  783. prop: 'orderAmount',
  784. type: 'number',
  785. rules: [
  786. {
  787. required: false,
  788. message: ' ',
  789. trigger: 'blur'
  790. }
  791. ]
  792. }, {
  793. label: '其他费用',
  794. prop: 'otherAmount',
  795. type: 'number',
  796. rules: [
  797. {
  798. required: false,
  799. message: ' ',
  800. trigger: 'blur'
  801. }
  802. ]
  803. }, {
  804. label: '溢付款',
  805. prop: 'overPayment',
  806. rules: [
  807. {
  808. required: false,
  809. message: ' ',
  810. trigger: 'blur'
  811. }
  812. ]
  813. },{
  814. label: '应收账款',
  815. prop: 'debitAmount',
  816. type: 'number',
  817. rules: [
  818. {
  819. required: false,
  820. message: ' ',
  821. trigger: 'blur'
  822. }
  823. ]
  824. }, {
  825. label: '已收款',
  826. prop: 'settlmentAmount',
  827. rules: [
  828. {
  829. required: false,
  830. message: ' ',
  831. trigger: 'blur'
  832. }
  833. ]
  834. }, {
  835. label: '应收未收款',
  836. prop: 'balanceAmount',//无
  837. disabled: true,
  838. rules: [
  839. {
  840. required: false,
  841. message: ' ',
  842. trigger: 'blur'
  843. }
  844. ]
  845. },
  846. // {
  847. // label: '应收预付款',
  848. // prop: 'advancePayment',
  849. // rules: [
  850. // {
  851. // required: false,
  852. // message: ' ',
  853. // trigger: 'blur'
  854. // }
  855. // ]
  856. // },
  857. {
  858. label: '保证金',
  859. prop: 'deposit',
  860. type: 'number',
  861. rules: [
  862. {
  863. required: false,
  864. message: ' ',
  865. trigger: 'blur'
  866. }
  867. ]
  868. }, {
  869. label: '逾期账款',
  870. prop: 'overDueAccounts',
  871. type: 'number',
  872. rules: [
  873. {
  874. required: false,
  875. message: ' ',
  876. trigger: 'blur'
  877. }
  878. ]
  879. }, {
  880. label: '实际发货日期',
  881. prop: 'actualDeliveryDate',
  882. type: 'datetime',
  883. rules: [
  884. {
  885. required: false,
  886. message: ' ',
  887. trigger: 'blur'
  888. }
  889. ]
  890. }, {
  891. label: '合同日期',
  892. prop: 'businesDate',
  893. type: 'date',
  894. rules: [
  895. {
  896. required: false,
  897. message: ' ',
  898. trigger: 'blur'
  899. }
  900. ]
  901. }, {
  902. label: '毛利率',
  903. prop: 'grossProfitRate',
  904. rules: [
  905. {
  906. required: false,
  907. message: ' ',
  908. trigger: 'blur'
  909. }
  910. ]
  911. }, {
  912. label: '毛利额',
  913. prop: 'grossProfit',
  914. type: 'number',
  915. rules: [
  916. {
  917. required: false,
  918. message: ' ',
  919. trigger: 'blur'
  920. }
  921. ]
  922. }, {
  923. label: '历史运费(元/条)',
  924. prop: 'freightAmountHistory',
  925. type: 'number',
  926. rules: [
  927. {
  928. required: false,
  929. message: ' ',
  930. trigger: 'blur'
  931. }
  932. ]
  933. }, {
  934. label: '到货日期',
  935. prop: 'arrivalDate',
  936. type: 'datetime',
  937. rules: [
  938. {
  939. required: false,
  940. message: ' ',
  941. trigger: 'blur'
  942. }
  943. ]
  944. }, {
  945. label: '预收款日期',
  946. type: 'datetime',
  947. prop: 'advanceCollectionDate',
  948. rules: [
  949. {
  950. required: false,
  951. message: ' ',
  952. trigger: 'blur'
  953. }
  954. ]
  955. }, {
  956. label: '积分倍数',
  957. prop: 'pointMutiple',
  958. rules: [
  959. {
  960. required: false,
  961. message: ' ',
  962. trigger: 'blur'
  963. }
  964. ]
  965. }, {
  966. label: '单据状态',
  967. prop: 'orderStatus',
  968. rules: [
  969. {
  970. required: false,
  971. message: ' ',
  972. trigger: 'blur'
  973. }
  974. ]
  975. },{
  976. label: '制单日期',
  977. prop: 'createTime',
  978. type: 'datetime',
  979. disabled:true,
  980. rules: [
  981. {
  982. required: false,
  983. message: ' ',
  984. trigger: 'blur'
  985. }
  986. ]
  987. }, {
  988. label: '特价占比',
  989. prop: 'a',
  990. disabled: false,
  991. rules: [
  992. {
  993. required: false,
  994. message: ' ',
  995. trigger: 'blur'
  996. }
  997. ]
  998. }, {
  999. label: '制单人',
  1000. prop: 'createUserName',
  1001. disabled: true,
  1002. rules: [
  1003. {
  1004. required: false,
  1005. message: ' ',
  1006. trigger: 'blur'
  1007. }
  1008. ]
  1009. },{
  1010. label: '特别提醒',
  1011. prop: 'specialRemarks',
  1012. type: 'textarea',
  1013. span: 24,
  1014. rules: [
  1015. {
  1016. required: false,
  1017. message: ' ',
  1018. trigger: 'blur'
  1019. }
  1020. ]
  1021. }
  1022. ]
  1023. },
  1024. basicData: {
  1025. column: [
  1026. {
  1027. label: '客户全称',
  1028. prop: 'corpId',
  1029. span: 16,
  1030. rules: [
  1031. {
  1032. required: true,
  1033. message: ' ',
  1034. trigger: 'blur'
  1035. }
  1036. ]
  1037. }, {
  1038. label: '到货地址',
  1039. prop: 'arrivalAddress',
  1040. rules: [
  1041. {
  1042. required: true,
  1043. message: ' ',
  1044. trigger: 'blur'
  1045. }
  1046. ]
  1047. }, {
  1048. label: '生产工厂',
  1049. prop: 'productionPlant',
  1050. span: 16,
  1051. rules: [
  1052. {
  1053. required: true,
  1054. message: ' ',
  1055. trigger: 'blur'
  1056. }
  1057. ]
  1058. },
  1059. {
  1060. label: '发货地址',
  1061. prop: 'shippingAddress',
  1062. disabled: true,
  1063. rules: [
  1064. {
  1065. required: true,
  1066. message: ' ',
  1067. trigger: 'blur'
  1068. }
  1069. ]
  1070. }, {
  1071. label: '所属公司',
  1072. prop: 'belongToCorpId',
  1073. span: 16,
  1074. rules: [
  1075. {
  1076. required: true,
  1077. message: ' ',
  1078. trigger: 'blur'
  1079. }
  1080. ]
  1081. }, {
  1082. label: '银行帐号',
  1083. prop: 'banks',
  1084. type: 'select',
  1085. rules: [
  1086. {
  1087. required: true,
  1088. message: ' ',
  1089. trigger: 'blur'
  1090. }
  1091. ]
  1092. }, {
  1093. label: '公司户头',
  1094. prop: 'banksAccountName',
  1095. rules: [
  1096. {
  1097. required: false,
  1098. message: ' ',
  1099. trigger: 'blur'
  1100. }
  1101. ]
  1102. }, {
  1103. label: '开户银行',
  1104. prop: 'accountBank',
  1105. rules: [
  1106. {
  1107. required: false,
  1108. message: ' ',
  1109. trigger: 'blur'
  1110. }
  1111. ]
  1112. }, {
  1113. label: '付款方式',
  1114. prop: 'paymentType',
  1115. rules: [
  1116. {
  1117. required: true,
  1118. message: ' ',
  1119. trigger: 'blur'
  1120. }
  1121. ]
  1122. }, {
  1123. label: '包装要求',
  1124. prop: 'packageRemarks',
  1125. rules: [
  1126. {
  1127. required: false,
  1128. message: ' ',
  1129. trigger: 'blur'
  1130. }
  1131. ]
  1132. }, {
  1133. label: '销售订单号',
  1134. prop: 'orderNo',
  1135. disabled: true,
  1136. rules: [
  1137. {
  1138. required: false,
  1139. message: ' ',
  1140. trigger: 'blur'
  1141. }
  1142. ]
  1143. }, {
  1144. label: '主订单号',
  1145. prop: 'morderNo',
  1146. rules: [
  1147. {
  1148. required: false,
  1149. message: ' ',
  1150. trigger: 'blur'
  1151. }
  1152. ]
  1153. }, {
  1154. label: '预估运费',
  1155. prop: 'oceanFreight',
  1156. type: 'number',
  1157. rules: [
  1158. {
  1159. required: true,
  1160. message: ' ',
  1161. trigger: 'blur'
  1162. }
  1163. ]
  1164. }, {
  1165. label: '要求发货日期',
  1166. prop: 'requiredDeliveryDate',
  1167. type: 'date',
  1168. rules: [
  1169. {
  1170. required: true,
  1171. message: ' ',
  1172. trigger: 'blur'
  1173. }
  1174. ]
  1175. }, {
  1176. label: '要求到货日期',
  1177. prop: 'requiredArrivalDate',
  1178. type: 'date',
  1179. rules: [
  1180. {
  1181. required: true,
  1182. message: ' ',
  1183. trigger: 'blur'
  1184. }
  1185. ]
  1186. }, {
  1187. label: "订单备注",
  1188. type: 'textarea',
  1189. span: 24,
  1190. prop: "orderRemark",
  1191. mock: {
  1192. type: 'county'
  1193. }
  1194. }
  1195. ]
  1196. },
  1197. // 银行账号下拉
  1198. bankList: [],
  1199. paymentOption: [],
  1200. statusOption: [],
  1201. // 费用信息排序的最大值
  1202. maxFeeNum: 0,
  1203. maxGoodsNum: 0,
  1204. oldForm: {
  1205. orderStatus: "录入"
  1206. },
  1207. oldGoodsList: [],
  1208. oldFeesList: [],
  1209. oldUploadList: [],
  1210. // 采购价格
  1211. purchasePriceOption: [],
  1212. // 销售价格
  1213. salesPriceOtion: [],
  1214. // 弹窗高度
  1215. rowHeight: '',
  1216. // 查询时loading页面
  1217. pageLoading: false,
  1218. switchDialog: false,
  1219. baseURL: '/api/blade-purchase-sales/orderitems/importPrice',
  1220. headers: { "Blade-Auth": 'Bearer ' + getToken()},
  1221. }
  1222. },
  1223. mounted() {
  1224. this.$nextTick(() => {
  1225. // 监听浏览器高度变化,改变表格高度
  1226. window.onresize = () => {
  1227. this.rowHeight = (window.innerHeight - 130) + 'px'
  1228. }
  1229. })
  1230. },
  1231. //初始化查询
  1232. async created() {
  1233. this.rowHeight = (window.innerHeight - 130) + 'px'
  1234. // this.customerContact = customerContact
  1235. this.customerContact = await this.getColumnData(this.getColumnName(15), customerContact);
  1236. this.advantageProject = await this.getColumnData(this.getColumnName(16), advantageProject);
  1237. this.getWorkDicts("payment_term").then(res => {
  1238. this.paymentOption = res.data.data
  1239. })
  1240. this.getWorkDicts("order_status").then(res => {
  1241. this.statusOption = res.data.data
  1242. })
  1243. this.$set(this.form, 'orderStatus', '录入')
  1244. this.$set(this.form, 'overPayment', 0)
  1245. this.$set(this.form, 'orderAmount', 0)
  1246. this.$set(this.form, 'oceanFreight', 0)
  1247. if (this.detailData.id) {
  1248. this.queryData(this.detailData.id)
  1249. }
  1250. if (this.detailData.seeDisabled) {
  1251. // this.bankOfDeposit.column.forEach(item => {
  1252. // item.editDisabled = true
  1253. // item.addDisabled = true
  1254. // })
  1255. }
  1256. if (this.detailData.copyId) {
  1257. this.queryData(this.detailData.copyId, true)
  1258. }
  1259. },
  1260. watch: {
  1261. },
  1262. methods: {
  1263. getGoodsRow(event,row) {
  1264. row.priceCategory = event.goodsTypeName
  1265. row.code = event.code
  1266. row.typeno = event.typeno
  1267. row.itemType = event.typeno
  1268. row.itemId = event.id
  1269. },
  1270. queryData(id, isCopy = false){
  1271. this.pageLoading = true
  1272. detail(id).then(res => {
  1273. this.form = res.data.data;
  1274. this.contactsData = this.form.orderItemsList
  1275. this.advantageProjectData = this.form.orderFeesList
  1276. this.bankOfDepositData = this.form.orderFilesList
  1277. this.configuration.dicData = this.form.corpName
  1278. if (this.form.belongToCorpList) {
  1279. this.companyConfiguration.dicData = this.form.belongToCorpList
  1280. }
  1281. if (this.form.productionPlantList) {
  1282. this.plantConfiguration.dicData = this.form.productionPlantList
  1283. }
  1284. let feesData = []
  1285. this.form.orderFeesList.forEach(item => {
  1286. let a = {
  1287. cname: item.corpName,
  1288. id: item.corpId
  1289. }
  1290. feesData.push(a)
  1291. })
  1292. this.configuration.dicData = this.configuration.dicData.concat(feesData)
  1293. // 去重
  1294. this.removeRepeat()
  1295. let goodsData = []
  1296. this.form.orderItemsList.forEach(item => {
  1297. let a = {
  1298. cname: item.cname,
  1299. }
  1300. goodsData.push(a)
  1301. })
  1302. this.goodsConfiguration.dicData = [].concat(goodsData)
  1303. this.removeGoodsRepeat()
  1304. delete this.form.orderItemsList
  1305. delete this.form.orderFeesList
  1306. delete this.form.orderFilesList
  1307. // delete this.form.corpName
  1308. delete this.form.belongToCorpList
  1309. // 获取最大值
  1310. let num = []
  1311. this.advantageProjectData.forEach(item => {
  1312. num.push(item.sort)
  1313. })
  1314. if (num.length == 0) {
  1315. this.maxFeeNum = 0;
  1316. } else {
  1317. this.maxFeeNum = num.reduce((a, b) => {
  1318. return b > a? b: a;
  1319. })
  1320. }
  1321. let goodsNum = []
  1322. let purchaseAmount = 0
  1323. this.contactsData.forEach(item => {
  1324. goodsNum.push(item.sort)
  1325. purchaseAmount += Number(item.purchaseAmount)
  1326. })
  1327. if (goodsNum.length == 0) {
  1328. this.maxGoodsNum = 0;
  1329. } else {
  1330. this.maxGoodsNum = goodsNum.reduce((a, b) => {
  1331. return b > a? b: a;
  1332. })
  1333. }
  1334. this.oldForm = Object.assign({}, this.form)
  1335. this.oldGoodsList = []
  1336. this.oldFeesList = []
  1337. this.oldUploadList = []
  1338. this.oldGoodsList = this.deepClone(this.contactsData)
  1339. this.oldFeesList = this.deepClone(this.advantageProjectData)
  1340. this.oldUploadList = this.deepClone(this.bankOfDepositData)
  1341. if (isCopy) {
  1342. this.$set(this.form, 'orderStatus', '录入')
  1343. delete this.form.id
  1344. delete this.form.orgOrderNo
  1345. delete this.form.morderNo
  1346. delete this.form.createUserName
  1347. delete this.form.createTime
  1348. this.contactsData.forEach(item => {
  1349. delete item.id
  1350. delete item.pid
  1351. })
  1352. this.advantageProjectData.forEach(item => {
  1353. delete item.id
  1354. delete item.pid
  1355. })
  1356. this.bankOfDepositData.forEach(item => {
  1357. delete item.id
  1358. delete item.pid
  1359. })
  1360. }
  1361. }).finally(() => {
  1362. this.saveLoading = false
  1363. this.pageLoading = false
  1364. });
  1365. },
  1366. // 复制新单
  1367. copyOrder() {
  1368. this.queryData(this.form.id, true)
  1369. },
  1370. getcorpId(row) {
  1371. this.contactsData[row.index].corpId = row.id;
  1372. },
  1373. // 采购金额获取
  1374. getPurchasePrice(row) {
  1375. getPurchasePrice({code: row.code}).then(res => {
  1376. this.purchasePriceOption = res.data.data
  1377. })
  1378. },
  1379. // 销售金额获取
  1380. getMarketPrice(row) {
  1381. getMarketPrice({code: row.code}).then(res => {
  1382. this.salesPriceOtion = res.data.data
  1383. })
  1384. },
  1385. // 生成采购单
  1386. saveSell() {
  1387. // if (!this.form.id) {
  1388. // return this.$message.error("此单据没有提交记录,请先提交");
  1389. // }
  1390. if (contrastObj(this.form, this.oldForm) ||
  1391. contrastList(this.contactsData, this.oldGoodsList) ||
  1392. contrastList(this.advantageProjectData, this.oldFeesList) ||
  1393. contrastList(this.bankOfDepositData, this.oldUploadList)
  1394. ) {
  1395. this.$confirm("数据发生变化未有提交记录, 是否保存?", "提示", {
  1396. confirmButtonText: "确定",
  1397. cancelButtonText: "取消",
  1398. type: "warning"
  1399. }).then(async () => {
  1400. await this.editCustomer(false, '采购')
  1401. }).catch(() => {
  1402. this.$message.info('已取消')
  1403. })
  1404. } else {
  1405. this.$confirm("是否生成采购单?", {
  1406. confirmButtonText: "确定",
  1407. cancelButtonText: "取消",
  1408. type: "warning"
  1409. }).then(() => {
  1410. saveSell(this.form.id).then(res => {
  1411. if (res.data.code == 200) {
  1412. this.$message.success("生成成功");
  1413. }
  1414. });
  1415. });
  1416. }
  1417. },
  1418. //点击行可编辑
  1419. handleRowClick(row, event, column) {
  1420. },
  1421. //商品编辑
  1422. rowCell(row, index) {
  1423. if (row.$cellEdit) {
  1424. if (Number(row.orderQuantity) < Number(row.actualQuantity)) {
  1425. return this.$message.error('订货数量不能小于发货数量')
  1426. }
  1427. }
  1428. this.$refs.crudContact.rowCell(row, index)
  1429. },
  1430. //费用编辑
  1431. rowCellTwo(row, index) {
  1432. console.log(row)
  1433. this.$refs.crudProject.rowCell(row, index)
  1434. },
  1435. //费用新增触发
  1436. costIncrease() {
  1437. this.dialogCost = !this.dialogCost
  1438. this.choiceData = false
  1439. },
  1440. //商品新增触发
  1441. commoditySelection() {
  1442. this.dialogVisible = !this.dialogVisible
  1443. this.tableData = []
  1444. this.commodityData = false
  1445. },
  1446. //政策价格导入
  1447. policy() {
  1448. this.policyDialog = !this.policyDialog
  1449. },
  1450. // 报表
  1451. openReport() {
  1452. this.switchDialog =! this.switchDialog;
  1453. },
  1454. // 下载模板
  1455. downloadHandle() {
  1456. this.$confirm('是否下载模板文件?', '提示', {
  1457. confirmButtonText: '确定',
  1458. cancelButtonText: '取消',
  1459. type: 'warning'
  1460. }).then(() => {
  1461. window.open(
  1462. `/api/blade-purchase-sales/orderitems/exportPrice?${
  1463. this.website.tokenHeader
  1464. }=${getToken()}`
  1465. );
  1466. }).catch(() => {
  1467. this.$message({
  1468. type: 'info',
  1469. message: '已取消'
  1470. });
  1471. })
  1472. },
  1473. //文件上传时
  1474. uploading(event, file, fileList) {
  1475. this.pageLoading = true;
  1476. // this.openFullScreen(false, '文件正在解析中');
  1477. },
  1478. importTemplate(res, file) {
  1479. console.log(res)
  1480. this.pageLoading = false
  1481. let goodsData = []
  1482. res.data.forEach(item => {
  1483. getMarketPrice({code: item.code}).then(res => {
  1484. if (res.data.data.length > 0) {
  1485. this.$set(item, 'price', res.data.data[0].salesPrice)
  1486. } else {
  1487. this.$set(item, 'price', '0')
  1488. }
  1489. })
  1490. getPurchasePrice({code: item.code}).then(res => {
  1491. if (res.data.data.length > 0) {
  1492. this.$set(item, 'purchaseAmount', res.data.data[0].purchasePrice)
  1493. } else {
  1494. this.$set(item, 'purchaseAmount', '0')
  1495. }
  1496. })
  1497. this.$set(item, 'actualQuantity', '0')
  1498. this.$set(item, 'purchaseAmount', '0')
  1499. this.$set(item, 'price', '0')
  1500. this.$set(item, 'amount', '0')
  1501. this.$set(item, 'sort', this.maxFeeNum + 1)
  1502. this.maxFeeNum++
  1503. let a = {
  1504. cname: item.cname,
  1505. }
  1506. goodsData.push(a)
  1507. })
  1508. this.goodsConfiguration.dicData = this.goodsConfiguration.dicData.concat(goodsData)
  1509. this.removeGoodsRepeat()
  1510. this.contactsData = this.contactsData.concat(res.data)
  1511. },
  1512. //遮罩层
  1513. openFullScreen(res, text) {
  1514. const loading = this.$loading({
  1515. lock: true,
  1516. text: text,
  1517. spinner: 'el-icon-loading',
  1518. background: 'rgba(0, 0, 0, 0.7)'
  1519. });
  1520. if (res === true) loading.close();
  1521. },
  1522. onClose(val) {
  1523. this.switchDialog = val;
  1524. },
  1525. getShipmentD() {
  1526. for (let item in this.selection) {
  1527. if (!this.selection[item].id) {
  1528. return this.$message.error('选中数据有新数据,请先保存')
  1529. }
  1530. }
  1531. if (this.$store.getters.inStatus) {
  1532. this.$alert("发货单存在,请保存发货单再进行操作", "温馨提示", {
  1533. confirmButtonText: "确定",
  1534. type: "warning",
  1535. callback: action => {
  1536. console.log(action);
  1537. }
  1538. });
  1539. } else {
  1540. this.generateShipmentD();
  1541. }
  1542. },
  1543. //生成发货单
  1544. async generateShipmentD() {
  1545. let lsit = []
  1546. if (contrastObj(this.form, this.oldForm) ||
  1547. contrastList(this.contactsData, this.oldGoodsList) ||
  1548. contrastList(this.advantageProjectData, this.oldFeesList) ||
  1549. contrastList(this.bankOfDepositData, this.oldUploadList)
  1550. ) {
  1551. this.$confirm("数据发生变化未有提交记录, 是否保存?", "提示", {
  1552. confirmButtonText: "确定",
  1553. cancelButtonText: "取消",
  1554. type: "warning"
  1555. }).then(() => {
  1556. this.editCustomer(false, '发货')
  1557. }).catch(() => {
  1558. this.$message({
  1559. type: 'info',
  1560. message: '已取消'
  1561. });
  1562. })
  1563. } else {
  1564. this.selection.forEach(item => {
  1565. lsit.push(item.id)
  1566. })
  1567. let data = {
  1568. id: this.form.id,
  1569. orderItemIds: lsit
  1570. }
  1571. generateShipment(data).then(res => {
  1572. this.$router.$avueRouter.closeTag("/businessManagement/deliveryNotice/index");
  1573. this.$router.push({
  1574. path: "/businessManagement/deliveryNotice/index",
  1575. query: {form: JSON.stringify(res.data.data)},
  1576. });
  1577. })
  1578. }
  1579. },
  1580. // 生成结算
  1581. applySettlement(type) {
  1582. if (contrastObj(this.form, this.oldForm) ||
  1583. contrastList(this.contactsData, this.oldGoodsList) ||
  1584. contrastList(this.advantageProjectData, this.oldFeesList) ||
  1585. contrastList(this.bankOfDepositData, this.oldUploadList)
  1586. ) {
  1587. this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
  1588. confirmButtonText: "确定",
  1589. cancelButtonText: "取消",
  1590. type: "warning"
  1591. }).then(() => {
  1592. this.editCustomer(true)
  1593. }).catch(() => {
  1594. })
  1595. } else {
  1596. this.beforeBillData(true,type)
  1597. this.applySettlementDialog = true;
  1598. }
  1599. },
  1600. //生成账单 拿到主表信息
  1601. beforeBillData(bool,type){
  1602. this.billType = type
  1603. this.billData = {
  1604. srcOrderno:this.form.orgOrderNo,
  1605. itemType:"销售",
  1606. corpsName:this.form.corpName,
  1607. corpId:this.form.corpId,
  1608. srcParentId: this.form.id,
  1609. currency: 'CNY',
  1610. exchangeRate: '1',
  1611. taxRate: '0',
  1612. accDate: this.form.businesDate,
  1613. }
  1614. if(bool){ //申请货款
  1615. this.billData.srcId = -1
  1616. }
  1617. },
  1618. //关闭账单
  1619. choceFun(){
  1620. this.applySettlementDialog = false
  1621. },
  1622. //商品选中触发
  1623. productSelection(selection) {
  1624. this.selection = selection
  1625. },
  1626. //点击费用明细选择触发
  1627. choice(row) {
  1628. this.dialogCost = !this.dialogCost
  1629. this.choiceData = true
  1630. console.log(row)
  1631. this.choiceIndex = row.$index
  1632. },
  1633. // 去重
  1634. removeRepeat() {
  1635. let obj = []
  1636. this.configuration.dicData = this.configuration.dicData.reduce((current,next) => {
  1637. obj[next.id] ? '': obj[next.id] = true && current.push(next)
  1638. return current
  1639. }, [])
  1640. },
  1641. removeGoodsRepeat() {
  1642. let obj = []
  1643. this.goodsConfiguration.dicData = this.goodsConfiguration.dicData.reduce((current,next) => {
  1644. obj[next.cname] ? '': obj[next.cname] = true && current.push(next)
  1645. return current
  1646. }, [])
  1647. },
  1648. //
  1649. receiveList(data){
  1650. this.configuration.dicData = this.configuration.dicData.concat(data)
  1651. this.removeRepeat()
  1652. },
  1653. receiveGoodList(data) {
  1654. console.log(data)
  1655. this.goodsConfiguration.dicData = this.goodsConfiguration.dicData.concat(data)
  1656. this.removeGoodsRepeat()
  1657. },
  1658. getCorpRow(data) {
  1659. this.$set(this.form, 'paymentType', data.paymentType)
  1660. this.$set(this.form, 'packageRemarks', data.remarks)
  1661. this.$set(this.form, 'arrivalAddress', data.storageAddr)
  1662. },
  1663. getPlantRow(data) {
  1664. this.$set(this.form, 'shippingAddress', data.storageAddr)
  1665. },
  1666. getRow(event,row) {
  1667. row.priceCategory = event[0].goodsTypeName
  1668. row.code = event[0].code
  1669. row.typeno = event[0].typeno
  1670. row.itemType = event[0].typeno
  1671. row.itemId = event[0].id
  1672. },
  1673. //点击商品明细选择触发
  1674. commodityChoice(row) {
  1675. this.dialogVisible = !this.dialogVisible
  1676. this.commodityData = true
  1677. console.log(row)
  1678. this.choiceIndexT = row.$index
  1679. },
  1680. //导入商品触发
  1681. importChoice() {
  1682. // this.contactsData = this.contactsData.concat(this.tableData)
  1683. if (this.tableData.length === 1) {
  1684. this.contactsData[this.choiceIndexT].cname = this.tableData[0].cname
  1685. this.contactsData[this.choiceIndexT].code = this.tableData[0].code
  1686. this.contactsData[this.choiceIndexT].typeno = this.tableData[0].typeno
  1687. this.contactsData[this.choiceIndexT].itemType = this.tableData[0].typeno
  1688. this.contactsData[this.choiceIndexT].itemId = this.tableData[0].id
  1689. this.contactsData[this.choiceIndexT].priceCategory = this.tableData[0].goodsTypeName
  1690. selectGoodsNum({
  1691. goodsId: this.tableData[0].id,
  1692. itemType: this.tableData[0].typeno
  1693. }).then(res => {
  1694. this.contactsData[this.choiceIndexT].storageQuantity = res.data.data
  1695. })
  1696. }
  1697. this.dialogVisible = !this.dialogVisible
  1698. this.commodityData = false
  1699. },
  1700. //费用编辑导入触发
  1701. choiceCost() {
  1702. if (this.tableDataCost.length === 1) {
  1703. this.advantageProjectData[this.choiceIndex].feeName = this.tableDataCost[0].cname
  1704. this.advantageProjectData[this.choiceIndex].itemId = this.tableDataCost[0].id
  1705. this.advantageProjectData[this.choiceIndex].code = this.tableDataCost[0].code
  1706. }
  1707. this.dialogCost = !this.dialogCost
  1708. this.choiceData = false
  1709. },
  1710. //费用导入触发
  1711. importCost() {
  1712. // this.advantageProjectForm = this.advantageProjectForm.concat(this.tableDataCost)
  1713. if (this.tableDataCost.length > 0) {
  1714. for (let item in this.tableDataCost) {
  1715. console.log(this.tableDataCost[item])
  1716. this.tableDataCost[item].itemId = this.tableDataCost[item].id
  1717. this.tableDataCost[item].feeName = this.tableDataCost[item].cname
  1718. this.$set(this.tableDataCost[item], 'amount', 0)
  1719. this.$set(this.tableDataCost[item], 'settlmentAmount', 0)
  1720. this.$set(this.tableDataCost[item], 'corpId', this.form.corpId)
  1721. this.tableDataCost[item].sort = this.maxFeeNum + 1
  1722. this.maxFeeNum++
  1723. delete this.tableDataCost[item].id
  1724. this.$refs.crudProject.rowCellAdd(this.tableDataCost[item]);
  1725. this.$refs.crudProject.rowCell(this.tableDataCost[item], this.advantageProjectForm.length - 1)
  1726. }
  1727. }
  1728. this.tableDataCost = []
  1729. this.dialogCost = false
  1730. },
  1731. //确认导入触发
  1732. importGoods() {
  1733. // this.contactsData = this.contactsData.concat(this.tableData)
  1734. if (this.tableData.length > 0) {
  1735. for (let item in this.tableData) {
  1736. // this.$set(this.tableData[item], 'storageQuantity', 0)
  1737. selectGoodsNum({
  1738. goodsId: this.tableData[item].id,
  1739. itemType: this.tableData[item].typeno
  1740. }).then(res => {
  1741. this.tableData[item].priceCategory = this.tableData[item].goodsTypeName
  1742. this.tableData[item].storageQuantity = res.data.data
  1743. delete this.tableData[item].goodsTypeName
  1744. this.tableData[item].itemId = this.tableData[item].id
  1745. this.$set(this.tableData[item], 'itemType', this.tableData[item].typeno)
  1746. this.$set(this.tableData[item], 'orderQuantity', 0)
  1747. this.$set(this.tableData[item], 'actualQuantity', 0)
  1748. this.$set(this.tableData[item], 'purchaseAmount', '0')
  1749. getMarketPrice({code: this.tableData[item].code}).then(res => {
  1750. if (res.data.data.length > 0) {
  1751. this.$set(this.tableData[item], 'price', res.data.data[0].salesPrice)
  1752. } else {
  1753. this.$set(this.tableData[item], 'price', '0')
  1754. }
  1755. })
  1756. getPurchasePrice({code: this.tableData[item].code}).then(res => {
  1757. if (res.data.data.length > 0) {
  1758. this.$set(this.tableData[item], 'purchaseAmount', res.data.data[0].purchasePrice)
  1759. } else {
  1760. this.$set(this.tableData[item], 'purchaseAmount', '0')
  1761. }
  1762. })
  1763. this.tableData[item].amount = 0
  1764. this.tableData[item].sort = this.maxGoodsNum + 1
  1765. if (this.form.packageRemarks) {
  1766. this.tableData[item].packageRemarks = this.form.packageRemarks
  1767. }
  1768. delete this.tableData[item].id
  1769. delete this.tableData[item].pid
  1770. delete this.tableData[item].isDeleted
  1771. delete this.tableData[item].status
  1772. delete this.tableData[item].tenantId
  1773. delete this.tableData[item].updateTime
  1774. delete this.tableData[item].updateUser
  1775. delete this.tableData[item].updateUserName
  1776. this.maxGoodsNum++
  1777. this.$refs.crudContact.rowCellAdd(this.tableData[item]);
  1778. this.$refs.crudContact.rowCell(this.tableData[item], this.contactsData.length - 1)
  1779. })
  1780. }
  1781. this.dialogVisible = false
  1782. }
  1783. },
  1784. closeGoods() {
  1785. this.treeDataGoods = [];
  1786. this.treeDeptId = "";
  1787. },
  1788. closeFees() {
  1789. this.treeDeptIdCost = "";
  1790. this.treeData = [];
  1791. },
  1792. closePolicy() {
  1793. this.treePolicyId = '';
  1794. this.dataPolicy = [];
  1795. this.policyForm = {};
  1796. this.contactsDataBuyFree = [];
  1797. this.policyData = []
  1798. this.policyDataTwo = []
  1799. },
  1800. //选中触发
  1801. selectionChange(list) {
  1802. this.tableData = list
  1803. },
  1804. //费用选中触发
  1805. selectionChangeCost(list) {
  1806. this.tableDataCost = list
  1807. },
  1808. //导入页左商品类型查询
  1809. nodeClick(data) {
  1810. this.treeDeptId = data.id;
  1811. this.page.currentPage = 1;
  1812. this.onLoad(this.page);
  1813. },
  1814. //导入页销售政策查询
  1815. policyNodeClick(data) {
  1816. this.treePolicyId = data.id
  1817. // detailList(data.id).then(res => {
  1818. // //特价促销
  1819. // this.dataPolicy = res.data.data.specialItemList
  1820. // //买赠促销
  1821. // this.contactsDataBuyFree = res.data.data.presentItemList
  1822. // })
  1823. this.policyOnLoad()
  1824. },
  1825. //导入页左费用类型查询
  1826. nodeClickCost(data) {
  1827. this.treeDeptIdCost = data.id;
  1828. this.pageCost.currentPage = 1;
  1829. this.onLoadCost(this.pageCost);
  1830. },
  1831. //刷新触发
  1832. refreshChange() {
  1833. this.treeDeptId = ''
  1834. this.page.currentPage = 1;
  1835. this.onLoad(this.page);
  1836. },
  1837. //销售政策特价促销选中触发
  1838. selectionChangePolicy(list) {
  1839. this.policyData = list
  1840. // this.policyData.forEach(item => {
  1841. // this.$set(item, 'price', item.specialOffer)
  1842. // })
  1843. if (this.policyData.length > 0) {
  1844. this.customerBuyFree.selection = false
  1845. } else {
  1846. this.customerBuyFree.selection = true
  1847. }
  1848. },
  1849. //销售政策买赠促销选中触发
  1850. selectionChangePolicyTwo(list) {
  1851. this.policyDataTwo = list
  1852. // this.policyDataTwo.forEach(item => {
  1853. // this.$set(item, 'price', item.salesPrice)
  1854. // })
  1855. if (this.policyDataTwo.length > 0) {
  1856. this.optionPolicy.selection = false
  1857. } else {
  1858. this.optionPolicy.selection = true
  1859. }
  1860. },
  1861. //导入商品政策
  1862. importPolicy() {
  1863. let list = this.deepClone(this.policyData.concat(this.policyDataTwo))
  1864. // 买赠额外加一条
  1865. let buyFree = []
  1866. if (this.policyDataTwo.length > 0) {
  1867. buyFree = this.deepClone(this.policyDataTwo)
  1868. }
  1869. for (let item in list) {
  1870. selectGoodsNum({
  1871. goodsId: list[item].itemId,
  1872. itemType: list[item].typeno
  1873. }).then(res => {
  1874. this.$set(list[item], 'storageQuantity', res.data.data)
  1875. if (this.policyDataTwo.length > 0) {
  1876. this.$set(buyFree[item], 'storageQuantity', res.data.data)
  1877. }
  1878. })
  1879. if (this.policyData.length > 0) {
  1880. this.$set(list[item], 'price', list[item].specialOffer)
  1881. } else {
  1882. this.$set(list[item], 'price', list[item].salesPrice)
  1883. this.$set(buyFree[item], 'price', '0')
  1884. this.$set(buyFree[item], 'orderQuantity', list[item].salesVolume)
  1885. this.$set(buyFree[item], 'itemType', list[item].typeno)
  1886. }
  1887. this.$set(list[item], 'itemType', list[item].typeno)
  1888. this.$set(list[item], 'actualQuantity', 0)
  1889. this.$set(list[item], 'orderQuantity', 0)
  1890. this.$set(list[item], 'amount', 0)
  1891. this.$set(list[item], 'priceCategory', list[item].productCategory)
  1892. this.$set(list[item], 'priceType', this.policyForm.cname)
  1893. this.$set(list[item], 'cname', list[item].productCategory)
  1894. this.$set(list[item], 'sort', this.maxGoodsNum + 1)
  1895. this.$set(list[item], 'purchaseAmount', list[item].purchasePrice)
  1896. if (this.policyDataTwo.length > 0) {
  1897. this.$set(buyFree[item], 'actualQuantity', 0)
  1898. this.$set(buyFree[item], 'amount', 0)
  1899. this.$set(buyFree[item], 'priceCategory', list[item].productCategory)
  1900. this.$set(buyFree[item], 'priceType', this.policyForm.cname)
  1901. this.$set(buyFree[item], 'cname', list[item].productCategory)
  1902. this.$set(buyFree[item], 'sort', this.maxGoodsNum + 2)
  1903. this.$set(buyFree[item], 'purchaseAmount', list[item].purchasePrice)
  1904. this.maxGoodsNum++
  1905. }
  1906. delete list[item].id
  1907. delete list[item].pid
  1908. delete list[item].isDeleted
  1909. delete list[item].status
  1910. delete list[item].tenantId
  1911. delete list[item].updateTime
  1912. delete list[item].updateUser
  1913. delete list[item].updateUserName
  1914. this.maxGoodsNum++
  1915. this.$refs.crudContact.rowCellAdd(list[item]);
  1916. // this.$refs.crudContact.rowCell(list[item], this.contactsData.length - 1)
  1917. if (this.policyDataTwo.length > 0) {
  1918. this.$refs.crudContact.rowCellAdd(buyFree[item]);
  1919. }
  1920. // this.$refs.crudContact.rowCell(buyFree[item], this.contactsData.length - 1)
  1921. }
  1922. this.policyDialog = false
  1923. },
  1924. //费用刷新触发
  1925. refreshChangeCost() {
  1926. this.treeDeptIdCost = '';
  1927. this.pageCost.currentPage = 1;
  1928. this.onLoadCost(this.pageCost);
  1929. },
  1930. //新增商品信息保存触发
  1931. rowSave(row, done, loading) {
  1932. console.log(row)
  1933. console.log(this.contactsData)
  1934. // this.contactsData.push(row)
  1935. done()
  1936. },
  1937. //修改商品信息触发
  1938. rowUpdate(row, index, done, loading) {
  1939. done(row);
  1940. },
  1941. //删除商品信息触发
  1942. rowDel(row, index, donerowDel) {
  1943. this.$confirm("确定将选择数据删除?", {
  1944. confirmButtonText: "确定",
  1945. cancelButtonText: "取消",
  1946. type: "warning"
  1947. }).then(() => {
  1948. //商品判断是否需要调用删除接口
  1949. if (row.id) {
  1950. corpsattn(row.id).then(res => {
  1951. this.$message({
  1952. type: "success",
  1953. message: "操作成功!"
  1954. });
  1955. this.contactsData.splice(index, 1);
  1956. })
  1957. } else {
  1958. this.$message({
  1959. type: "success",
  1960. message: "操作成功!"
  1961. });
  1962. this.contactsData.splice(index, 1);
  1963. }
  1964. })
  1965. },
  1966. //新增费用明细保存触发
  1967. rowSaveProject(row, done, loading) {
  1968. // this.advantageProjectData.push(row)
  1969. done()
  1970. },
  1971. //修改费用明细触发
  1972. rowUpdateProject(row, index, done, loading) {
  1973. done(row);
  1974. },
  1975. policyOnLoad(params = {}) {
  1976. // this.policyLoading = true;
  1977. detailList(this.treePolicyId).then(res => {
  1978. this.policyForm = res.data.data
  1979. //特价促销
  1980. if(res.data.data.specialItemList) {
  1981. this.dataPolicy = res.data.data.specialItemList
  1982. } else {
  1983. this.dataPolicy = []
  1984. }
  1985. //买赠促销
  1986. if (res.data.data.presentItemList) {
  1987. this.contactsDataBuyFree = res.data.data.presentItemList
  1988. } else {
  1989. this.contactsDataBuyFree = []
  1990. }
  1991. })
  1992. },
  1993. //
  1994. goodsSearch(params, done) {
  1995. this.treeDeptId = ''
  1996. this.onLoad(this.page, params);
  1997. done()
  1998. },
  1999. //商品列表查询
  2000. onLoad(page, params = {}) {
  2001. console.log(params)
  2002. this.loading = true;
  2003. getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId).then(res => {
  2004. console.log(res)
  2005. const data = res.data.data;
  2006. this.page.total = data.total;
  2007. this.data = data.records;
  2008. this.loading = false;
  2009. });
  2010. },
  2011. // 费用查询按钮
  2012. feesSearch(params, done) {
  2013. this.treeDeptIdCost = '';
  2014. this.onLoadCost(this.pageCost, params)
  2015. done()
  2016. },
  2017. //费用查询
  2018. onLoadCost(page, params = {}) {
  2019. this.loadingCost = true;
  2020. let queryParams = Object.assign({}, params, {
  2021. pageSize: page.pageSize,
  2022. pageNum: page.currentPage,
  2023. parentId: 0,
  2024. feesTypeId: this.treeDeptIdCost
  2025. })
  2026. customerList(queryParams).then(res => {
  2027. console.log(res)
  2028. const data = res.data.data;
  2029. this.pageCost.total = data.total;
  2030. this.dataCost = data.records;
  2031. this.loadingCost = false;
  2032. });
  2033. },
  2034. //删除费用明细触发
  2035. rowDelProject(row, index, donerowDel) {
  2036. this.$confirm("确定将选择数据删除?", {
  2037. confirmButtonText: "确定",
  2038. cancelButtonText: "取消",
  2039. type: "warning"
  2040. }).then(() => {
  2041. //费用判断是否需要调用删除接口
  2042. if (row.id) {
  2043. corpsitem(row.id).then(res => {
  2044. this.$message({
  2045. type: "success",
  2046. message: "操作成功!"
  2047. });
  2048. this.advantageProjectData.splice(index, 1);
  2049. })
  2050. } else {
  2051. this.$message({
  2052. type: "success",
  2053. message: "操作成功!"
  2054. });
  2055. this.advantageProjectData.splice(index, 1);
  2056. }
  2057. })
  2058. },
  2059. //新增附件上传保存触发
  2060. rowSaveBankOfDeposit(row, done, loading) {
  2061. this.bankOfDepositData.push(row)
  2062. done()
  2063. },
  2064. //修改附件上传触发
  2065. rowUpdateBankOfDeposit(row, index, done, loading) {
  2066. done(row);
  2067. },
  2068. //删除附件上传触发
  2069. rowDelBankOfDeposit(row, index, donerowDel) {
  2070. this.$confirm("确定将选择数据删除?", {
  2071. confirmButtonText: "确定",
  2072. cancelButtonText: "取消",
  2073. type: "warning"
  2074. }).then(() => {
  2075. //附件判断是否需要调用删除接口
  2076. if (row.id) {
  2077. corpsbank(row.id).then(res => {
  2078. this.$message({
  2079. type: "success",
  2080. message: "操作成功!"
  2081. });
  2082. this.bankOfDepositData.splice(index, 1);
  2083. })
  2084. } else {
  2085. this.$message({
  2086. type: "success",
  2087. message: "操作成功!"
  2088. });
  2089. this.bankOfDepositData.splice(index, 1);
  2090. }
  2091. })
  2092. },
  2093. uploadAfter(res, done) {
  2094. if (res.originalName) {
  2095. this.bankOfDepositForm.fileName = this.bankOfDepositForm.fileName
  2096. ? this.bankOfDepositForm.fileName
  2097. : res.originalName;
  2098. }
  2099. done();
  2100. },
  2101. //修改提交触发
  2102. editCustomer(isBack = false, type) {
  2103. this.$refs["form"].validate((valid) => {
  2104. if (valid) {
  2105. for (let item in this.contactsData) {
  2106. if (Number(this.contactsData[item].orderQuantity) < Number(this.contactsData[item].actualQuantity)) {
  2107. return this.$message.error('商品信息第'+ (parseInt(item) + 1) + '行订货数量不能小于发货数量')
  2108. }
  2109. }
  2110. let packFee;
  2111. if (this.form.packageRemarks) {
  2112. packFee = this.advantageProjectData.findIndex(item => item.feeName == '包装费')
  2113. }
  2114. if (packFee == -1) {
  2115. return this.$message.error('费用明细未有包装费')
  2116. }
  2117. // 计算毛利额
  2118. this.$set(this.form, 'orderAmount', 0)
  2119. // 成本价
  2120. let purchaseAmount = 0
  2121. // 计算销售金额
  2122. this.contactsData.forEach(item => {
  2123. if (item.purchaseAmount) {
  2124. purchaseAmount += (Number(item.purchaseAmount) * Number(item.orderQuantity)).toFixed(2)
  2125. }
  2126. this.form.orderAmount = (Number(this.form.orderAmount) + Number(item.amount)).toFixed(2)
  2127. })
  2128. if (this.form.orderAmount && this.form.settlmentAmount) {
  2129. this.$set(this.form, "balanceAmount", (Number(this.form.orderAmount) - Number(this.form.settlmentAmount)).toFixed(2));
  2130. }
  2131. //商品信息
  2132. this.form.orderItemsList = this.contactsData
  2133. this.form.orderFeesList = this.advantageProjectData
  2134. this.form.orderFilesList = this.bankOfDepositData
  2135. if (typeof this.form.corpsTypeId == 'object') {
  2136. this.form.corpsTypeId = this.form.corpsTypeId.join(",")
  2137. }
  2138. this.form.billType = 'XS'
  2139. this.saveLoading = true
  2140. typeSave(this.form).then(res => {
  2141. this.$message({type: "success", message: this.form.id ? "修改成功!" : "新增成功!"});
  2142. if (isBack) {
  2143. //成功关闭此页面回到列表页
  2144. this.$emit("goBack");
  2145. } else {
  2146. this.queryData(res.data.data.id)
  2147. }
  2148. if (type == '发货') {
  2149. let lsit = []
  2150. this.selection.forEach(item => {
  2151. lsit.push(item.id)
  2152. })
  2153. let data = {
  2154. id: this.form.id,
  2155. orderItemIds: lsit
  2156. }
  2157. generateShipment(data).then(res => {
  2158. this.$router.$avueRouter.closeTag("/businessManagement/deliveryNotice/index");
  2159. this.$router.push({
  2160. path: "/businessManagement/deliveryNotice/index",
  2161. query: {form: JSON.stringify(res.data.data)},
  2162. });
  2163. })
  2164. } else if (type == '采购') {
  2165. this.$confirm("是否生成采购单?", {
  2166. confirmButtonText: "确定",
  2167. cancelButtonText: "取消",
  2168. type: "warning"
  2169. }).then(() => {
  2170. saveSell(this.form.id).then(res => {
  2171. if (res.data.code == 200) {
  2172. this.$message.success("生成成功");
  2173. }
  2174. });
  2175. });
  2176. }
  2177. }).finally(() => {
  2178. this.saveLoading = false
  2179. })
  2180. } else {
  2181. return false;
  2182. }
  2183. });
  2184. },
  2185. // 计算应收未收款
  2186. computedCost() {
  2187. // 销售金额
  2188. let orderAmount = 0;
  2189. // 已收款
  2190. let settlmentAmount = 0;
  2191. // 溢付款
  2192. let overPayment = 0
  2193. if (this.form.orderAmount) {
  2194. orderAmount = this.form.orderAmount
  2195. }
  2196. if (this.form.settlmentAmount) {
  2197. settlmentAmount = this.form.settlmentAmount
  2198. }
  2199. if (this.form.overPayment) {
  2200. overPayment = this.form.overPayment
  2201. }
  2202. this.$set(this.form, "balanceAmount", (Number(orderAmount) - Number(overPayment) - Number(settlmentAmount)).toFixed(2));
  2203. },
  2204. quantityChange(row) {
  2205. if (!row.orderQuantity) {
  2206. row.orderQuantity = 0;
  2207. } else {
  2208. // row.amount = _.multiply(row.price, row.orderQuantity).toFixed(2);
  2209. row.amount = (row.price * row.orderQuantity).toFixed(2)
  2210. }
  2211. },
  2212. priceChange(row) {
  2213. console.log(row.price)
  2214. if (!row.price) {
  2215. row.price = 0;
  2216. } else {
  2217. row.amount = (row.price * row.orderQuantity).toFixed(2)
  2218. }
  2219. },
  2220. //返回列表
  2221. backToList() {
  2222. if (contrastObj(this.form, this.oldForm) ||
  2223. contrastList(this.contactsData, this.oldGoodsList) ||
  2224. contrastList(this.advantageProjectData, this.oldFeesList) ||
  2225. contrastList(this.bankOfDepositData, this.oldUploadList)
  2226. ) {
  2227. this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
  2228. confirmButtonText: "确定",
  2229. cancelButtonText: "取消",
  2230. type: "warning"
  2231. }).then(() => {
  2232. this.editCustomer(true)
  2233. }).catch(() => {
  2234. this.$emit("goBack");
  2235. })
  2236. } else {
  2237. this.$emit("goBack");
  2238. }
  2239. },
  2240. // 保存列设置
  2241. async saveColumn(name) {
  2242. /**
  2243. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  2244. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  2245. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  2246. */
  2247. if (name == 'goods') {
  2248. const inSave = await this.saveColumnData(
  2249. this.getColumnName(15),
  2250. this.customerContact
  2251. );
  2252. if (inSave) {
  2253. this.$message.success("保存成功");
  2254. //关闭窗口
  2255. this.$refs.crudContact.$refs.dialogColumn.columnBox = false;
  2256. }
  2257. } else if (name === 'fees') {
  2258. const inSave = await this.saveColumnData(
  2259. this.getColumnName(16),
  2260. this.advantageProject
  2261. );
  2262. if (inSave) {
  2263. this.$message.success("保存成功");
  2264. //关闭窗口
  2265. this.$refs.crudProject.$refs.dialogColumn.columnBox = false;
  2266. }
  2267. }
  2268. },
  2269. returnBack(val) {
  2270. getlistBankBy(val).then(res =>{
  2271. this.$set(this.form, 'banks', null)
  2272. this.$set(this.form, 'banksAccountName', null)
  2273. this.$set(this.form, 'accountBank', null)
  2274. this.bankList = res.data
  2275. if (this.bankList.length > 0) {
  2276. this.form.banks = this.bankList[0].accountNo
  2277. this.form.banksAccountName = this.bankList[0].accountName
  2278. this.form.accountBank = this.bankList[0].accountBank
  2279. }
  2280. })
  2281. },
  2282. // 银行账号变化
  2283. banksChange(val) {
  2284. let isTrue = false
  2285. this.bankList.forEach(item => {
  2286. if (val == item.accountNo) {
  2287. this.$set(this.form, 'banksAccountName', item.accountName)
  2288. this.$set(this.form, 'accountBank', item.accountBank)
  2289. isTrue = true
  2290. }
  2291. })
  2292. if (!isTrue) {
  2293. this.$set(this.form, 'banksAccountName', null)
  2294. this.$set(this.form, 'accountBank', null)
  2295. }
  2296. },
  2297. }
  2298. }
  2299. </script>
  2300. <style lang="scss" scoped>
  2301. //.customer-head {
  2302. // position: fixed;
  2303. // top: 105px;
  2304. // width: 100%;
  2305. // margin-left: -10px;
  2306. // height: 62px;
  2307. // background: #ffffff;
  2308. // box-shadow: 0 4px 12px 0px rgba(232, 232, 235, 1);
  2309. // z-index: 999;
  2310. // /* display: flex;
  2311. // justify-content: left; */
  2312. //}
  2313. //
  2314. //.customer-back {
  2315. // cursor: pointer;
  2316. // line-height: 62px;
  2317. // font-size: 16px;
  2318. // color: #323233;
  2319. // font-weight: 400;
  2320. //}
  2321. .back-icon {
  2322. line-height: 64px;
  2323. font-size: 20px;
  2324. margin-right: 8px;
  2325. }
  2326. //.add-customer-btn {
  2327. // position: fixed;
  2328. // right: 36px;
  2329. // top: 115px;
  2330. //}
  2331. ::v-deep .el-form-item {
  2332. margin-bottom: 0;
  2333. }
  2334. .el-dialogDeep {
  2335. ::v-deep .el-dialog {
  2336. margin: 1vh auto 0 !important;
  2337. padding-bottom: 10px !important;
  2338. .el-dialog__body, .el-dialog__footer {
  2339. padding-bottom: 0 !important;
  2340. padding-top: 0 !important;
  2341. }
  2342. }
  2343. }
  2344. .print-div {
  2345. color: #000;
  2346. }
  2347. .print_table {
  2348. table {
  2349. border-right: 1px solid #000;
  2350. border-bottom: 1px solid #000;
  2351. font-size: 12px;
  2352. margin-bottom: 5px;
  2353. }
  2354. table td {
  2355. border-left: 1px solid #000;
  2356. border-top: 1px solid #000;
  2357. vertical-align: middle;
  2358. padding: 2px;
  2359. text-align: center;
  2360. }
  2361. }
  2362. .table {
  2363. border-collapse: collapse;
  2364. border-spacing: 0;
  2365. background-color: transparent;
  2366. display: table;
  2367. width: 99%;
  2368. max-width: 100%;
  2369. margin: 0 auto;
  2370. }
  2371. .table td {
  2372. text-align: left;
  2373. vertical-align: middle;
  2374. font-size: 14px;
  2375. color: #000000;
  2376. padding: 10.5px 0 10.5px 30px;
  2377. //border: 1px solid #000;
  2378. }
  2379. ::v-deep .el-form-item {
  2380. margin-bottom: 0;
  2381. }
  2382. ::v-deep .el-form-item__content{
  2383. line-height: 32px;
  2384. }
  2385. ///deep/ .avue-tree {
  2386. // display: flex;
  2387. // flex-direction: column;
  2388. // overflow-y: hidden;
  2389. // height: 100%;
  2390. //}
  2391. ///deep/ .avue-tree__filter {
  2392. // flex-shrink: 1;
  2393. //}
  2394. ///deep/ .avue-tree__content {
  2395. // height: calc(100% - 32px);
  2396. // overflow-y: auto;
  2397. //}
  2398. </style>