ContractChange.vue 100 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920
  1. <template>
  2. <div style="width: 100%; padding: 0px 15px">
  3. <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="formDom">
  4. <template #btn>
  5. <div>
  6. <el-button type="primary" v-if="
  7. [30].includes(route.query.processType) || !route.query.processType
  8. " @click="clickCopy(1)">复制订单</el-button>
  9. </div>
  10. </template>
  11. <template #ofCompanyId>
  12. <div style="width: 100%">
  13. <el-form-item label="业务公司" class="margin-b-0 wid100" required>
  14. <el-row style="width: 100%">
  15. <el-col :span="12">
  16. <el-form-item prop="ofCompanyId" label="" label-width="0px" class="margin-b-0 wid100">
  17. <el-tree-select v-model="formData.data.ofCompanyId"
  18. :data="isFormDetail ?useUserStore().allDict['tree_all_company_data']:useUserStore().allDict['tree_company_data']"
  19. style="width: 100%" placeholder="公司" default-expand-all
  20. :props="{ value: 'deptId', label: 'deptName', children: 'children', disabled: 'disabled' }"
  21. @change="handleOfCompanyIdChange" :disabled="useUserStore().currentCompany==useUserStore().user.ofCompanyId" />
  22. </el-form-item>
  23. </el-col>
  24. <el-col :span="12">
  25. <el-form-item prop="deptId" label="" label-width="0px" class="margin-b-0 wid100">
  26. <el-tree-select v-model="formData.data.deptId" :data="deptData" style="width: 100%" placeholder="部门" default-expand-all
  27. :props="{ value: 'deptId', label: 'deptName', children: 'children', disabled: 'disabled' }" />
  28. <!-- :disabled="useUserStore().currentCompany==useUserStore().user.ofCompanyId" -->
  29. </el-form-item>
  30. </el-col>
  31. </el-row>
  32. </el-form-item>
  33. </div>
  34. </template>
  35. <template #seller>
  36. <div style="width: 100%;position:relative">
  37. <el-form-item prop="sellCorporationId" label="卖方信息" class="wid100">
  38. <el-select v-model="formData.data.sellCorporationId" placeholder="请选择卖方公司" style="width: 100%" @change="sellCorporationIdChange"
  39. filterable>
  40. <el-option v-for="item in corporationList" :key="item.value" :label="item.label" :value="item.value" />
  41. </el-select>
  42. </el-form-item>
  43. <!-- <div style="position:absolute;top:0px;right:-20px;cursor:pointer" @click="isShowOther =!isShowOther">
  44. <el-icon v-if="!isShowOther">
  45. <ArrowDownBold />
  46. </el-icon>
  47. <el-icon v-else>
  48. <ArrowUpBold />
  49. </el-icon>
  50. </div> -->
  51. <div v-show="isShowOther">
  52. <el-form-item label="地址" class="wid100">
  53. <el-row style="width:100%">
  54. <el-col :span="8">
  55. <el-form-item label="" prop="sellCountryName" label-width="0px" class="margin-b-0 wid100">
  56. <el-input v-model="formData.data.sellCountryName" placeholder="请输入国家" />
  57. </el-form-item>
  58. </el-col>
  59. <el-col :span="8">
  60. <el-form-item label="" prop="sellProvinceName" label-width="0px" class="margin-b-0 wid100">
  61. <el-input v-model="formData.data.sellProvinceName" placeholder="请输入省/州" />
  62. </el-form-item>
  63. </el-col>
  64. <el-col :span="8">
  65. <el-form-item label="" prop="sellCityName" label-width="0px" class="margin-b-0 wid100">
  66. <el-input v-model="formData.data.sellCityName" placeholder="请输入城市" />
  67. </el-form-item>
  68. </el-col>
  69. </el-row>
  70. </el-form-item>
  71. <el-form-item label="详细地址" prop="sellAddress" class="wid100">
  72. <el-input v-model="formData.data.sellAddress" type="textarea">
  73. </el-input>
  74. </el-form-item>
  75. <el-form-item label="联系人" class="wid100">
  76. <el-row style="width:100%">
  77. <el-col :span="8">
  78. <el-form-item label="" prop="sellContactName" label-width="0px" class="margin-b-0 wid100">
  79. <el-input v-model="formData.data.sellContactName" placeholder="请输入联系人" />
  80. </el-form-item>
  81. </el-col>
  82. <el-col :span="16">
  83. <el-form-item label="" prop="sellContactNumber" label-width="0px" class="margin-b-0 wid100">
  84. <el-input v-model="formData.data.sellContactNumber" placeholder="请输入联系人电话" />
  85. </el-form-item>
  86. </el-col>
  87. </el-row>
  88. </el-form-item>
  89. </div>
  90. </div>
  91. </template>
  92. <template #buyer>
  93. <div style="width: 100%;position:relative">
  94. <el-form-item label="买方信息" prop="buyCorporationId" class="wid100">
  95. <el-select v-model="formData.data.buyCorporationId" filterable remote reserve-keyword placeholder="请输入关键字" remote-show-suffix
  96. :remote-method="remoteMethod" :loading="loadingSearch" @input="remoteMethod" style="width: 100%" @change="changeCustomer" v-if="
  97. [30].includes(route.query.processType) ||
  98. !route.query.processType
  99. " :disabled="!isEditList">
  100. <el-option v-for="item in customerList" :key="item.value" :label="item.label" :value="item.value" />
  101. </el-select>
  102. <el-select v-model="formData.data.buyCorporationName" disabled v-else style="width: 100%">
  103. </el-select>
  104. </el-form-item>
  105. <div style="position:absolute;top:0px;right:-20px;cursor:pointer" @click="isShowOther =!isShowOther">
  106. <el-icon v-if="!isShowOther">
  107. <ArrowDownBold />
  108. </el-icon>
  109. <el-icon v-else>
  110. <ArrowUpBold />
  111. </el-icon>
  112. </div>
  113. <div v-show="isShowOther">
  114. <el-form-item label="地址" class="wid100" required>
  115. <el-row style="width: 100%">
  116. <el-col :span="6">
  117. <el-form-item label="" prop="countryId" class="margin-b-0">
  118. <el-select v-model="formData.data.countryId" placeholder="国家" style="width:100%" filterable
  119. @change="(val) => getCityData(val, '20', true)" :disabled="!isEditList">
  120. <el-option v-for="item in countryData" :label="item.name" :value="item.id">
  121. </el-option>
  122. </el-select>
  123. </el-form-item>
  124. </el-col>
  125. <el-col :span="6">
  126. <el-form-item label="" prop="provinceName" class="margin-b-0">
  127. <selectCity placeholder="省/洲" @change="(val) => getCityData(val, '30', true)" addressId="provinceId" addressName="provinceName"
  128. v-model="formData.data" :data="provinceData" :disabled="!isEditList">
  129. </selectCity>
  130. </el-form-item>
  131. </el-col>
  132. <el-col :span="6">
  133. <el-form-item label="" prop="cityName" class="margin-b-0">
  134. <selectCity placeholder="城市" addressId="cityId" addressName="cityName" v-model="formData.data" :data="cityData"
  135. :disabled="!isEditList">
  136. </selectCity>
  137. </el-form-item>
  138. </el-col>
  139. <el-col :span="6">
  140. <el-form-item label="" prop="buyPostalCode" class="margin-b-0">
  141. <el-input v-model="formData.data.buyPostalCode" placeholder="请输入邮编" :disabled="!isEditList" />
  142. </el-form-item>
  143. </el-col>
  144. </el-row>
  145. </el-form-item>
  146. <el-form-item label="详细地址" prop="buyAddress" class="wid100">
  147. <el-input v-model="formData.data.buyAddress" type="textarea" :disabled="!isEditList">
  148. </el-input>
  149. </el-form-item>
  150. <el-form-item label="联系人" class="wid100" required>
  151. <el-row style="width: 100%">
  152. <el-col :span="8">
  153. <el-form-item label="" prop="buyContactName" label-width="0px" class="margin-b-0 wid100">
  154. <el-autocomplete v-model="formData.data.buyContactName" :fetch-suggestions="querySearchPerson" style="width:100%" clearable
  155. class="inline-input w-50" placeholder="请输入联系人" @select="handlePerson" :disabled="!isEditList">
  156. </el-autocomplete>
  157. </el-form-item>
  158. </el-col>
  159. <el-col :span="16">
  160. <el-form-item label="" prop="buyContactNumber" label-width="0px" class="margin-b-0 wid100">
  161. <el-input v-model="formData.data.buyContactNumber" placeholder="请输入联系人电话" :disabled="!isEditList" />
  162. </el-form-item>
  163. </el-col>
  164. </el-row>
  165. </el-form-item>
  166. </div>
  167. </div>
  168. </template>
  169. <template #advanceRatio>
  170. <el-row style="width: 100%">
  171. <el-col :span="6" style="padding-right:8px">
  172. <el-form-item label="定金比例(%)" prop="advanceRatio" class="margin-b-0 wid100">
  173. <el-input-number v-model="formData.data.advanceRatio" placeholder="请输入" style="width: 100%" :precision="2" :min="0" :max="100"
  174. :controls="false" @change="(val)=>changeAdvanceRatio(val,true)" />
  175. </el-form-item>
  176. </el-col>
  177. <el-col :span="6" style="padding:0px 4px">
  178. <el-form-item label="出货前付款比例" prop="beforeShipmentRatio" class="margin-b-0 wid100">
  179. <el-input-number v-model="formData.data.beforeShipmentRatio" placeholder="请输入" style="width: 100%" :precision="2" :min="0" :max="100"
  180. :controls="false" @change="(val)=>changeAdvanceRatio(val,false)" />
  181. </el-form-item>
  182. </el-col>
  183. <el-col :span="6" style="padding:0px 4px">
  184. <el-form-item label="出货后付款比例" prop="afterShipmentRatio" class="margin-b-0 wid100">
  185. <el-input-number v-model="formData.data.afterShipmentRatio" placeholder=" " style="width: 100%" :precision="2" :min="0" :max="100"
  186. :controls="false" disabled />
  187. </el-form-item>
  188. </el-col>
  189. </el-row>
  190. </template>
  191. <template #commodity>
  192. <div style="width: 100%">
  193. <el-button type="primary" @click="openProductCompany = true" plain style="margin-bottom: 16px"
  194. v-if="!judgeStatus() && isEditList">产品库</el-button>
  195. <!-- :disabled="!formData.data.companyId" -->
  196. <!-- default-expand-all -->
  197. <el-table :data="formData.data.contractProductList" style="width: 100%;" row-key="rowId">
  198. <el-table-column type="expand" width="50" align="center">
  199. <template #default="scope">
  200. <div style="padding-left:50px">
  201. <div style="margin-bottom:10px;">
  202. <TitleInfo content='BOM单:'></TitleInfo>
  203. <div v-if="route.query.flowKey=='contract_update_flow'" style="margin-top:10px">
  204. <el-button type="primary" @click="openDialog(scope.$index,1)" plain>主材</el-button>
  205. <el-button type="primary" @click="openDialog(scope.$index,2)" plain>工艺</el-button>
  206. <el-button type="primary" @click="openDialog(scope.$index,3)" plain>辅材</el-button>
  207. </div>
  208. </div>
  209. <el-table :data="scope.row.contractProductBomList" style="width: 100%;" border class="bom-table" row-key="materialId">
  210. <el-table-column label="图片" width="80">
  211. <template #default="{ row }">
  212. <div v-if="row.fileUrl">
  213. <img :src="row.fileUrl" class="pic" @click="onPicture(row.fileUrl)" />
  214. </div>
  215. <div v-else></div>
  216. </template>
  217. </el-table-column>
  218. <el-table-column prop="productCode" label="物料编码" width="190" />
  219. <el-table-column prop="productName" label="物料名称" width="170" />
  220. <el-table-column label="规格尺寸 (cm)" width="130">
  221. <template #default="{ row, $index }">
  222. <div style="width: 100%" v-if="row.productLength">
  223. {{row.productLength}} * {{row.productWidth}} * {{row.productHeight}}
  224. </div>
  225. </template>
  226. </el-table-column>
  227. <el-table-column prop="productColor" label="颜色" width="170" />
  228. <el-table-column prop="standardDosage" label="标准用量" width="100">
  229. <template #default="{ row, $index }">
  230. <div style="width: 100%">
  231. <el-form-item v-if="route.query.flowKey=='contract_update_flow'"
  232. :prop="'contractProductList.' + scope.$index + '.contractProductBomList.' + $index + '.standardDosage'"
  233. :rules="rules.standardDosage" :inline-message="true" class="margin-b-0 wid100">
  234. <el-input-number onmousewheel="return false;" v-model="row.standardDosage" placeholder="请输入" style="width: 100%"
  235. :precision="0" :controls="false" :min="1" @change="calculationAmount(true)" />
  236. </el-form-item>
  237. <span v-else>{{row.standardDosage}}</span>
  238. </div>
  239. </template>
  240. </el-table-column>
  241. <el-table-column prop="lossRate" label="损耗率(%)" width="100">
  242. <template #default="{ row, $index }">
  243. <div style="width: 100%">
  244. <el-form-item v-if="route.query.flowKey=='contract_update_flow'"
  245. :prop="'contractProductList.' + scope.$index + '.contractProductBomList.' + $index + '.lossRate'"
  246. :rules="rules.lossRate" :inline-message="true" class="margin-b-0 wid100">
  247. <el-input-number onmousewheel="return false;" v-model="row.lossRate" placeholder="请输入" style="width: 100%" :precision="2"
  248. :controls="false" :min="0" @change="calculationAmount(true)" />
  249. </el-form-item>
  250. <span v-else>{{row.lossRate}}</span>
  251. </div>
  252. </template>
  253. </el-table-column>
  254. <el-table-column prop="quantity" label="数量" width="100">
  255. <template #default="{ row, $index }">
  256. <div style="width: 100%">
  257. <el-form-item v-if="isEditList"
  258. :prop="'contractProductList.' + scope.$index + '.contractProductBomList.' + $index + '.quantity'"
  259. :rules="rules.quantity" :inline-message="true" class="margin-b-0 wid100">
  260. <el-input-number onmousewheel="return false;" v-model="row.quantity" placeholder="请输入" style="width: 100%" :precision="0"
  261. :controls="false" :min="1" disabled />
  262. </el-form-item>
  263. <span v-else>{{row.quantity}}</span>
  264. </div>
  265. </template>
  266. </el-table-column>
  267. <!-- <el-table-column prop="allQuantity" label="总量" width="80" /> -->
  268. <!-- <el-table-column prop="price" label="单价" width="110">
  269. <template #default="{ row, $index }">
  270. <div style="width: 100%">
  271. ¥ {{row.price}}
  272. </div>
  273. </template>
  274. </el-table-column> -->
  275. <!-- <el-table-column prop="amount" label="小计" width="110">
  276. <template #default="{ row, $index }">
  277. <div style="width: 100%">
  278. ¥ {{row.amount}}
  279. </div>
  280. </template>
  281. </el-table-column> -->
  282. <!-- <el-table-column prop="remark" label="备注" width="180">
  283. <template #default="{ row, $index }">
  284. <div style="width: 100%">
  285. <el-form-item v-if="isEditList" :inline-message="true" class="margin-b-0 wid100">
  286. <el-input v-model="row.remark" placeholder="请输入" style="width: 100%" />
  287. </el-form-item>
  288. <span v-else>{{row.remark}}</span>
  289. </div>
  290. </template>
  291. </el-table-column> -->
  292. <el-table-column prop="remark" label="备注" min-width="150" />
  293. <el-table-column label="附件" min-width="130">
  294. <template #default="{ row, $index }">
  295. <div style="width: 100%">
  296. <div class="el-click" v-for="file in row.bomFileList " :key="file.id" @click="openImg(file.fileUrl)"> {{file.fileName}}
  297. </div>
  298. </div>
  299. </template>
  300. </el-table-column>
  301. <!-- <el-table-column label="操作" width="60" align="center" fixed="right" v-if="!judgeStatus() && isEditList">
  302. <template #default="{ row,$index }">
  303. <el-button type="primary" link @click="handleDeleteMaterial(scope.$index,$index)">删除</el-button>
  304. </template>
  305. </el-table-column> -->
  306. </el-table>
  307. </div>
  308. </template>
  309. </el-table-column>
  310. <el-table-column label="商品图片" width="80">
  311. <template #default="{ row }">
  312. <div v-if="row.fileUrl">
  313. <img :src="row.fileUrl" class="pic" @click="onPicture(row.fileUrl)" />
  314. </div>
  315. <div v-else></div>
  316. </template>
  317. </el-table-column>
  318. <el-table-column prop="productName" label="商品信息" width="250">
  319. <template #default="{ row, $index }">
  320. <div style="width: 100%;line-height:22px">
  321. <div>
  322. 分类:{{row.productClassifyName}}
  323. </div>
  324. <div>
  325. 编码:{{row.productCode}}
  326. </div>
  327. <div>
  328. 名称:{{row.productName}}
  329. </div>
  330. <div>
  331. 规格尺寸 (cm): {{row.productLength}} * {{row.productWidth}} * {{row.productHeight}}
  332. </div>
  333. <div>
  334. 颜色:{{row.productColor}}
  335. </div>
  336. <div>
  337. 纹路:{{dictKeyValue(row.productFrontalTexture,frontLinesData)}}
  338. </div>
  339. <div>
  340. 净重: {{row.productNetWeight}}
  341. </div>
  342. <div>
  343. 单位:{{row.productUnit}}
  344. </div>
  345. <!-- <el-row :gutter="5">
  346. <el-col :span="12">
  347. 分类:{{row.productClassifyName}}
  348. </el-col>
  349. <el-col :span="12">
  350. 编码名称:{{row.productCode}}({{row.productName}})
  351. </el-col>
  352. </el-row>
  353. <el-row :gutter="5">
  354. <el-col :span="12">
  355. 规格尺寸 (cm): {{row.productLength}} * {{row.productWidth}} * {{row.productHeight}}
  356. </el-col>
  357. <el-col :span="12">
  358. 颜色:{{row.productColor}}
  359. </el-col>
  360. </el-row>
  361. <el-row :gutter="5">
  362. <el-col :span="12">
  363. 纹路:{{dictKeyValue(row.productFrontalTexture,frontLinesData)}}
  364. </el-col>
  365. <el-col :span="6">
  366. 净重: {{row.productNetWeight}}
  367. </el-col>
  368. <el-col :span="6">
  369. 单位:{{row.productUnit}}
  370. </el-col>
  371. </el-row> -->
  372. </div>
  373. </template>
  374. </el-table-column>
  375. <!-- <el-table-column label="规格尺寸 (cm)" width="130">
  376. <template #default="{ row, $index }">
  377. <div style="width: 100%">
  378. {{row.productLength}} * {{row.productWidth}} * {{row.productHeight}}
  379. </div>
  380. </template>
  381. </el-table-column>
  382. <el-table-column prop="productColor" label="颜色" width="140" />
  383. <el-table-column prop="ww" label="纹路" width="140" />
  384. <el-table-column prop="weight" label="净重" width="140" />
  385. <el-table-column prop="unit" label="单位" width="140" /> -->
  386. <el-table-column label="生产plt文件" width="180">
  387. <template #default="{ row, $index }">
  388. <div style="width:100%">
  389. <!-- <div style="display:flex">
  390. <div style="writing-mode: vertical-rl;margin-right:10px;background:rgb(94 120 145);color:#fff;padding:5px 2px;border-radius:3px;line-height:21px;;cursor:pointer"
  391. @click="handleClickUploadOne($index)" v-if="!judgeStatus()">
  392. {{row.isShowProductFile?'上 传 p l t':'取 消 上 传'}}
  393. </div>
  394. <div>
  395. <div v-if="row.isShowProductFile &&row.fileListOne && row.fileListOne.length > 0">
  396. <span class="el-click" @click="onPicture(row.fileListOne[0].fileUrl)">{{row.fileListOne[0].fileName}}</span>
  397. </div>
  398. <div v-else>
  399. <el-upload :file-list="row.prodFileList" :action="uploadUrl" :data="uploadData" :limit="1" :list-type="'text'"
  400. :before-upload="(file)=>handleBeforeUploadOne(file,$index)" :on-success="()=>handleSuccessOne($index)"
  401. :on-remove="(file)=>handleRemoveFile(file,$index)" :on-preview="onPreviewFile"
  402. :on-exceed="()=>msgTip(`上传文件数量不可大于1`, 2)">
  403. <el-button text type="primary">上传</el-button>
  404. </el-upload>
  405. </div>
  406. </div>
  407. </div> -->
  408. <div>
  409. <!-- writing-mode: vertical-rl; 文字垂直排 -->
  410. <div style="margin-right:10px;background:rgb(94 120 145);color:#fff;padding:5px 2px;border-radius:3px;line-height:21px;;cursor:pointer;width:60px;text-align:center"
  411. @click="handleClickUploadOne($index)" v-if="!judgeStatus()">
  412. {{row.isShowProductFile?'上传plt':'取消上传'}}
  413. </div>
  414. <div>
  415. <div v-if="row.isShowProductFile &&row.fileListOne && row.fileListOne.length > 0">
  416. <span class="el-click" @click="onPicture(row.fileListOne[0].fileUrl)">{{row.fileListOne[0].fileName}}</span>
  417. </div>
  418. <div v-else>
  419. <el-upload :file-list="row.prodFileList" :action="uploadUrl" :data="uploadData" :limit="1" :list-type="'text'"
  420. :before-upload="(file)=>handleBeforeUploadOne(file,$index)" :on-success="()=>handleSuccessOne($index)"
  421. :on-remove="(file)=>handleRemoveFile(file,$index)" :on-preview="onPreviewFile"
  422. :on-exceed="()=>msgTip(`上传文件数量不可大于1`, 2)">
  423. <el-button text type="primary">上传</el-button>
  424. </el-upload>
  425. </div>
  426. </div>
  427. </div>
  428. </div>
  429. </template>
  430. </el-table-column>
  431. <el-table-column label="数量" width="110">
  432. <template #default="{ row, $index }">
  433. <div style="width: 100%">
  434. <el-form-item :prop="'contractProductList.' + $index + '.quantity'" :rules="rules.quantity" :inline-message="true"
  435. class="margin-b-0 wid100">
  436. <el-input-number onmousewheel="return false;" v-model="row.quantity" placeholder="请输入" style="width: 100%" :precision="0"
  437. :controls="false" :min="0" @change="calculationAmount(true)" v-if="isEditList" />
  438. <div v-else> {{row.quantity}}</div>
  439. </el-form-item>
  440. </div>
  441. </template>
  442. </el-table-column>
  443. <el-table-column label="单价" width="160">
  444. <template #default="{ row, $index }">
  445. <div style="width: 100%">
  446. <el-form-item :prop="'contractProductList.' + $index + '.price'" :rules="rules.price" :inline-message="true"
  447. class="margin-b-0 wid100">
  448. <div style="display:flex;">
  449. <el-input-number onmousewheel="return false;" v-model="row.price" placeholder="请输入" style="width: 100%" :precision="2"
  450. :controls="false" :min="0" @change="calculationAmount()" v-if="isEditList" />
  451. <div v-else>¥ {{row.price}}</div>
  452. <el-popover placement="top-start" :width="400" trigger="hover" @show="showEcharts(row,$index)">
  453. <template #default>
  454. <div>
  455. <div>
  456. <img src="@/assets/images/money1.png" alt="" class="img" /> <span
  457. style="font-size:14px;font-weight:700;color:#000">销售指导价:</span>
  458. <div style="padding:5px 0px 0px 20px">
  459. {{row.currency}} {{moneyFormat(row.salePrice,2)}}
  460. </div>
  461. </div>
  462. <div style="margin-top:15px">
  463. <img src="@/assets/images/money2.png" alt="" class="img" /> <span
  464. style="font-size:14px;font-weight:700;color:#000">客户近期购买价格:</span>
  465. <div style="padding:5px 0px 0px 20px">
  466. <div v-for="item in row.customerContractProductList">
  467. <span>{{item.createTime.slice(0,10)}} </span>
  468. <span style="margin-left:40px">{{item.code}} </span>
  469. <span style="margin-left:40px"> {{item.currency}} {{moneyFormat(item.price,2)}} </span>
  470. </div>
  471. </div>
  472. </div>
  473. <div style="margin-top:15px">
  474. <img src="@/assets/images/money3.png" alt="" class="img" /> <span
  475. style="font-size:14px;font-weight:700;color:#000">产品近期销售价格:</span>
  476. <div style="padding:5px 0px 0px 20px">
  477. <div v-for="item in row.contractProductList">
  478. <span>{{item.createTime.slice(0,10)}} </span>
  479. <span style="margin-left:40px">{{item.code}} </span>
  480. <span style="margin-left:40px">{{item.currency}} {{moneyFormat(item.price,2)}} </span>
  481. </div>
  482. </div>
  483. </div>
  484. <div :ref="row.productId+$index" style="height:180px">
  485. </div>
  486. </div>
  487. </template>
  488. <template #reference>
  489. <!-- <div style="margin-left:10px;cursor:pointer;position:relative;top:4px">
  490. <el-icon :size="20" color="#85c1a6">
  491. <WarningFilled />
  492. </el-icon>
  493. </div> -->
  494. </template>
  495. </el-popover>
  496. </div>
  497. </el-form-item>
  498. </div>
  499. </template>
  500. </el-table-column>
  501. <el-table-column label="业务供货价" prop="factoryPrice" width="100">
  502. </el-table-column>
  503. <el-table-column prop="amount" label="小计" width="110">
  504. <template #default="{ row, $index }">
  505. <div style="width: 100%">
  506. ¥ {{row.amount}}
  507. </div>
  508. </template>
  509. </el-table-column>
  510. <el-table-column prop="amountTwo" label="业务小计金额" width="110">
  511. <template #default="{ row, $index }">
  512. <div style="width: 100%">
  513. ¥ {{row.amountTwo}}
  514. </div>
  515. </template>
  516. </el-table-column>
  517. <el-table-column label="备注" min-width="200">
  518. <template #default="{ row, $index }">
  519. <div style="width: 100%">
  520. <el-form-item :prop="'contractProductList.' + $index + '.remark'" :inline-message="true" class="margin-b-0 wid100">
  521. <el-input v-model="row.remark" placeholder="请输入" style="width: 100%" />
  522. </el-form-item>
  523. </div>
  524. </template>
  525. </el-table-column>
  526. <el-table-column label="操作" width="80" align="center" fixed="right" v-if="!judgeStatus() && isEditList">
  527. <template #default="{ $index }">
  528. <!-- <el-button type="primary" link @click="handleClickSelectMaterial($index)">包材/配件/辅材</el-button> -->
  529. <el-button type="primary" link @click="handleRemove($index)">删除</el-button>
  530. </template>
  531. </el-table-column>
  532. </el-table>
  533. </div>
  534. </template>
  535. <template #otherCharge>
  536. <div style="width: 100%">
  537. <el-button type="primary" @click="clickAdd()" plain style="margin-bottom: 16px" v-if="!judgeStatus()">添加行</el-button>
  538. <el-table :data="formData.data.contractProjectList" style="width: 100%;">
  539. <el-table-column label="收费项目" width="220">
  540. <template #default="{ row, $index }">
  541. <div style="width: 100%">
  542. <el-form-item :prop="'contractProjectList.' + $index + '.payName'" :rules="rules.payName" :inline-message="true"
  543. class="margin-b-0 wid100">
  544. <el-autocomplete v-model="row.payName" :fetch-suggestions="querySearch" clearable class="inline-input w-50"
  545. placeholder="请输入收费项目" />
  546. </el-form-item>
  547. </div>
  548. </template>
  549. </el-table-column>
  550. <el-table-column :label="'金额'" width="130">
  551. <template #default="{ row, $index }">
  552. <div style="width: 100%">
  553. <el-form-item :prop="'contractProjectList.' + $index + '.amount'" :rules="rules.amount" :inline-message="true"
  554. class="margin-b-0 wid100">
  555. <el-input-number onmousewheel="return false;" v-model="row.amount" placeholder="请输入金额" style="width: 100%" :precision="2"
  556. :controls="false" :min="0" @change="totalAmount()" />
  557. </el-form-item>
  558. </div>
  559. </template>
  560. </el-table-column>
  561. <el-table-column label="备注">
  562. <template #default="{ row, $index }">
  563. <div style="width: 100%">
  564. <el-form-item :prop="'contractProjectList.' + $index + '.remark'" class="margin-b-0 wid100">
  565. <el-input v-model="row.remark" placeholder="请输入备注" />
  566. </el-form-item>
  567. </div>
  568. </template>
  569. </el-table-column>
  570. <el-table-column label="操作" width="60" align="center" fixed="right" v-if="!judgeStatus()">
  571. <template #default="{ $index }">
  572. <el-button type="primary" link @click="handleDelete($index)">删除</el-button>
  573. </template>
  574. </el-table-column>
  575. </el-table>
  576. </div>
  577. </template>
  578. <template #templateContent>
  579. <div style="width: 100%">
  580. <Editor :value="formData.data.templateContent" @updateValue="updateContent" :readOnly="judgeStatus()" ref="remarkEditor" />
  581. </div>
  582. </template>
  583. <template #contractFileList>
  584. <div style="width: 100%">
  585. <div v-for="(file, index) in formData.data.contractFileList" :key="index">
  586. <span class="el-click" @click="openImg(file.fileUrl)">{{ file.fileName }}</span>
  587. </div>
  588. </div>
  589. </template>
  590. </byForm>
  591. <el-dialog v-if="openProductCompany" v-model="openProductCompany" title="产品库" width="90%" append-to-body>
  592. <SelectProduct @selectProduct="selectProduct"></SelectProduct>
  593. <!-- :disablePerm="'1'" -->
  594. <!-- :isRawMaterial="'1'" -->
  595. <!-- :companyId="formData.data.companyId" -->
  596. <template #footer>
  597. <el-button @click="openProductCompany = false" size="defualt" v-debounce>关 闭</el-button>
  598. </template>
  599. </el-dialog>
  600. <el-dialog :title="'原材料选择'" v-model="openSelectRawMaterial" width="90%" destroy-on-close>
  601. <SelectMaterial :ancestors="110" @selectMaterial="selectRawMaterial"></SelectMaterial>
  602. <template #footer>
  603. <el-button @click="openSelectRawMaterial = false" size="defualt" v-debounce>取 消</el-button>
  604. </template>
  605. </el-dialog>
  606. <el-dialog :title="'工艺选择'" v-model="openSelectTechnology" width="90%" destroy-on-close>
  607. <SelectTechnology :isSelect="true" @selectTechnology="selectTechnology"></SelectTechnology>
  608. <template #footer>
  609. <el-button @click="openSelectTechnology = false" size="defualt" v-debounce>取 消</el-button>
  610. </template>
  611. </el-dialog>
  612. <el-dialog :title="'物料选择'" v-model="openSelectMaterial" width="90%" destroy-on-close>
  613. <SelectMaterial :isNeRawMaterial="'1'" @selectMaterial="selectMaterial"></SelectMaterial>
  614. <template #footer>
  615. <el-button @click="openSelectMaterial = false" size="defualt" v-debounce>关 闭</el-button>
  616. </template>
  617. </el-dialog>
  618. <!-- <el-dialog v-if="copyContract" v-model="copyContract" :title="copyType === 1 ? '订单选择' : '样品单选择'" width="90%" append-to-body>
  619. <SelectContract @select="selectContract" v-if="copyType === 1"></SelectContract>
  620. <SelectSample @select="selectContract" v-if="copyType === 2"></SelectSample>
  621. </el-dialog> -->
  622. </div>
  623. </template>
  624. <script setup>
  625. import byForm from "@/components/byForm/index";
  626. import SelectProduct from "@/components/product/SelectProduct.vue";
  627. import SelectMaterial from "@/components/product/SelectMaterial.vue";
  628. import SelectTechnology from "@/views/production/project/technology/index.vue";
  629. import Editor from "@/components/Editor/index.vue";
  630. import selectCity from "@/components/selectCity/index.vue";
  631. import { useRoute } from "vue-router";
  632. import SelectContract from "@/components/contractCom/selectContract.vue";
  633. import SelectSample from "@/components/contractCom/selectSample.vue";
  634. import * as echarts from "echarts";
  635. import $bus from "@/bus/index.js";
  636. import { v4 as uuidv4 } from "uuid";
  637. const route = useRoute();
  638. const { proxy } = getCurrentInstance();
  639. // 接收父组件的传值
  640. const props = defineProps({
  641. queryData: Object,
  642. });
  643. const currencyData = computed(
  644. () => proxy.useUserStore().allDict["account_currency"]
  645. );
  646. const fundsPaymentMethod = computed(
  647. () => proxy.useUserStore().allDict["funds_payment_method"]
  648. );
  649. const shippingMethod = computed(
  650. () => proxy.useUserStore().allDict["shipping_method"]
  651. );
  652. const contractChannel = computed(
  653. () => proxy.useUserStore().allDict["contract_channel"]
  654. );
  655. const taxTransportationWay = computed(
  656. () => proxy.useUserStore().allDict["tax_transportation_way"]
  657. );
  658. const shopName = computed(() => proxy.useUserStore().allDict["shop_name"]);
  659. const taxPoints = computed(() => proxy.useUserStore().allDict["tax_points"]);
  660. const settlementWay = computed(
  661. () => proxy.useUserStore().allDict["settlement_way"]
  662. );
  663. const frontLinesData = computed(
  664. () => proxy.useUserStore().allDict["front_lines"]
  665. );
  666. const qualityLevel = computed(
  667. () => proxy.useUserStore().allDict["quality_level"]
  668. );
  669. const accountList = ref([]);
  670. const customerList = ref([]);
  671. const templateList = ref([]);
  672. const sampleData = ref([]);
  673. const sealUseData = ref([]);
  674. const userList = ref([]);
  675. const corporationList = ref([]);
  676. const customerUserList = ref([]);
  677. const countryData = ref([]);
  678. const provinceData = ref([]);
  679. const cityData = ref([]);
  680. const treeData = ref([]);
  681. const deptData = ref([]);
  682. const openProductCompany = ref(false);
  683. const copyType = ref(1);
  684. const copyContract = ref(false);
  685. const indexValue = ref(-1);
  686. const openSelectMaterial = ref(false);
  687. const isShowOther = ref(false);
  688. const formData = reactive({
  689. data: {
  690. contractType: "2",
  691. rate: 1,
  692. contractProductList: [],
  693. companyId: "",
  694. templateContent: "",
  695. contractChannel: "",
  696. paymentMethod: "",
  697. },
  698. });
  699. const uploadData = ref({});
  700. const formDom = ref(null);
  701. const remarkEditor = ref(null);
  702. const judgeStatus = () => {
  703. if (
  704. route.query.processType == 20 ||
  705. route.query.processType == 10 ||
  706. props.queryData.processType == 20 ||
  707. props.queryData.processType == 10
  708. ) {
  709. return true;
  710. }
  711. if (props.queryData.recordList && props.queryData.recordList.length > 0) {
  712. let data = props.queryData.recordList.filter(
  713. (item) => item.status === 2 && item.nodeType !== 1
  714. );
  715. if (data && data.length > 0) {
  716. return true;
  717. }
  718. }
  719. return false;
  720. };
  721. const formOption = reactive({
  722. inline: true,
  723. labelWidth: 120,
  724. itemWidth: 100,
  725. disabled: false,
  726. });
  727. const formConfig = computed(() => {
  728. return [
  729. // {
  730. // type: "slot",
  731. // slotName: "btn",
  732. // label: "",
  733. // itemWidth: 50,
  734. // },
  735. {
  736. type: "title",
  737. title: "基本信息",
  738. },
  739. {
  740. type: "input",
  741. prop: "code",
  742. label: "订单号",
  743. disabled: true,
  744. isShow: formData.data.code ? true : false,
  745. },
  746. // {
  747. // type: "treeSelect",
  748. // prop: "ofCompanyId",
  749. // label: "业务公司",
  750. // data: proxy.useUserStore().allDict["tree_company_data"],
  751. // propsTreeLabel: "deptName",
  752. // propsTreeValue: "deptId",
  753. // itemWidth: 50,
  754. // },
  755. {
  756. type: "slot",
  757. slotName: "ofCompanyId",
  758. label: "",
  759. itemWidth: 50,
  760. },
  761. {
  762. type: "select",
  763. prop: "contractType",
  764. label: "订单类型",
  765. data: [
  766. {
  767. dictKey: "3",
  768. dictValue: "打样订单",
  769. },
  770. {
  771. dictKey: "2",
  772. dictValue: "内销订单",
  773. },
  774. {
  775. dictKey: "1",
  776. dictValue: "外贸订单(退税)",
  777. },
  778. {
  779. dictKey: "4",
  780. dictValue: "外贸订单(不退税)",
  781. },
  782. ],
  783. itemWidth: 50,
  784. fn: (val) => {
  785. if (val == "2") {
  786. formData.data.currency = currencyData.value[0].dictKey;
  787. formData.data.rate = 1;
  788. }
  789. if (formData.data.sellCorporationId) {
  790. sellCorporationIdChange(formData.data.sellCorporationId);
  791. }
  792. if (formData.data.shroffAccountId) {
  793. changeShroffAccount(formData.data.shroffAccountId);
  794. }
  795. },
  796. },
  797. {
  798. type: "select",
  799. prop: "processingMethod",
  800. label: "订单处理方式",
  801. data: [
  802. {
  803. dictKey: 10,
  804. dictValue: "业务自采",
  805. },
  806. {
  807. dictKey: 20,
  808. dictValue: "生产处理",
  809. },
  810. ],
  811. itemWidth: 50,
  812. },
  813. // {
  814. // type: "treeSelect",
  815. // prop: "companyId",
  816. // label: "工厂",
  817. // data: treeData.value,
  818. // propsTreeLabel: "deptName",
  819. // propsTreeValue: "deptId",
  820. // itemWidth: 50,
  821. // disabled: !isEditList.value,
  822. // fn: () => {
  823. // formData.data.contractProductList = [];
  824. // },
  825. // },
  826. {
  827. type: "select",
  828. prop: "belongType",
  829. label: "订单归属",
  830. data: [
  831. {
  832. dictKey: "1",
  833. dictValue: "归属工厂",
  834. },
  835. {
  836. dictKey: "2",
  837. dictValue: "归属业务",
  838. },
  839. ],
  840. itemWidth: 50,
  841. },
  842. {
  843. type: "select",
  844. prop: "contractChannel",
  845. label: "订单渠道",
  846. data: contractChannel.value,
  847. itemWidth: 50,
  848. },
  849. {
  850. type: "input",
  851. prop: "channelCode",
  852. label: "渠道订单编号",
  853. itemWidth: 50,
  854. isShow:
  855. formData.data.contractChannel &&
  856. formData.data.contractChannel.includes("阿里巴巴")
  857. ? true
  858. : false,
  859. },
  860. {
  861. type: "select",
  862. prop: "salesmanId",
  863. label: "业务员",
  864. data: userList.value,
  865. disabled: true,
  866. itemWidth: 50,
  867. },
  868. {
  869. type: "select",
  870. prop: "merchUserId",
  871. label: "跟单员",
  872. data: userList.value,
  873. itemWidth: 50,
  874. },
  875. {
  876. type: "select",
  877. prop: "placeOrderType",
  878. label: "是否首单",
  879. data: [
  880. {
  881. dictKey: "10",
  882. dictValue: "首单",
  883. },
  884. {
  885. dictKey: "20",
  886. dictValue: "返单",
  887. },
  888. ],
  889. itemWidth: 50,
  890. },
  891. {
  892. type: "select",
  893. prop: "qualityLv",
  894. label: "品质等级",
  895. data: qualityLevel.value,
  896. itemWidth: 50,
  897. },
  898. {
  899. type: "select",
  900. prop: "sampleId",
  901. label: "关联样品单",
  902. data: sampleData.value,
  903. itemWidth: 50,
  904. },
  905. {
  906. type: "title",
  907. title: "贸易信息",
  908. haveLine: true,
  909. },
  910. {
  911. type: "slot",
  912. slotName: "seller",
  913. label: "",
  914. itemWidth: 50,
  915. },
  916. {
  917. type: "slot",
  918. slotName: "buyer",
  919. label: "",
  920. itemWidth: 50,
  921. },
  922. {
  923. type: "title",
  924. title: "收款信息",
  925. haveLine: true,
  926. },
  927. // {
  928. // type: "select",
  929. // prop: "currency",
  930. // label: "币种",
  931. // data: currencyData.value,
  932. // itemWidth: 25,
  933. // disabled: formData.data.contractType == "2",
  934. // },
  935. // {
  936. // type: "number",
  937. // prop: "rate",
  938. // label: "汇率",
  939. // precision: 2,
  940. // min: 0,
  941. // controls: false,
  942. // itemWidth: 25,
  943. // disabled: formData.data.contractType == "2",
  944. // },
  945. {
  946. type: "select",
  947. prop: "isTax",
  948. label: "是否含税",
  949. data: [
  950. {
  951. dictKey: "1",
  952. dictValue: "含税",
  953. },
  954. {
  955. dictKey: "0",
  956. dictValue: "不含税",
  957. },
  958. ],
  959. itemWidth: 25,
  960. },
  961. {
  962. type: "select",
  963. prop: "taxPoints",
  964. label: "税点",
  965. data: taxPoints.value,
  966. itemWidth: 25,
  967. isShow: formData.data.isTax && formData.data.isTax == "1" ? true : false,
  968. },
  969. {
  970. type: "select",
  971. prop: "isFreight",
  972. label: "是否含运费",
  973. data: [
  974. {
  975. dictKey: "1",
  976. dictValue: "含运费",
  977. },
  978. {
  979. dictKey: "0",
  980. dictValue: "不含运费",
  981. },
  982. ],
  983. itemWidth: 25,
  984. },
  985. {
  986. type: "select",
  987. prop: "settlementMethod",
  988. label: "客户结算方式",
  989. data: settlementWay.value,
  990. itemWidth: 25,
  991. },
  992. {
  993. type: "select",
  994. prop: "paymentMethod",
  995. label: "客户付款方式",
  996. data: fundsPaymentMethod.value,
  997. itemWidth: 25,
  998. fn: (val) => {
  999. if (val.indexOf("bank") != -1) {
  1000. getaccountList(val);
  1001. }
  1002. },
  1003. },
  1004. // {
  1005. // type: "select",
  1006. // prop: "paymentMethod",
  1007. // label: "付款方式",
  1008. // data: fundsPaymentMethod.value,
  1009. // itemWidth: 25,
  1010. // },
  1011. {
  1012. type: "input",
  1013. prop: "alibabaCode",
  1014. label: "阿里巴巴订单编号",
  1015. itemType: "text",
  1016. itemWidth: 25,
  1017. isShow:
  1018. formData.data.paymentMethod &&
  1019. formData.data.paymentMethod.includes("阿里巴巴")
  1020. ? true
  1021. : false,
  1022. },
  1023. {
  1024. type: "select",
  1025. prop: "alibabaShopName",
  1026. label: "1688店铺名称",
  1027. data: shopName.value,
  1028. itemWidth: 25,
  1029. isShow:
  1030. formData.data.paymentMethod &&
  1031. formData.data.paymentMethod.includes("阿里巴巴")
  1032. ? true
  1033. : false,
  1034. },
  1035. {
  1036. type: "select",
  1037. prop: "shroffAccountId",
  1038. label: "收款账号",
  1039. data: accountList.value,
  1040. itemWidth: 50,
  1041. fn: (val) => {
  1042. changeShroffAccount(val);
  1043. },
  1044. isShow:
  1045. formData.data.paymentMethod == "bank1" ||
  1046. formData.data.paymentMethod == "bank2",
  1047. },
  1048. {
  1049. type: "input",
  1050. prop: "accountName",
  1051. label: "户名",
  1052. placeholder: "请输入户名",
  1053. itemWidth: 50,
  1054. isShow:
  1055. formData.data.paymentMethod &&
  1056. formData.data.paymentMethod.includes("bank")
  1057. ? true
  1058. : false,
  1059. },
  1060. {
  1061. type: "input",
  1062. prop: "openingBank",
  1063. label: "开户行",
  1064. placeholder: "请输入开户行",
  1065. itemWidth: 50,
  1066. isShow:
  1067. formData.data.paymentMethod &&
  1068. formData.data.paymentMethod.includes("bank")
  1069. ? true
  1070. : false,
  1071. },
  1072. {
  1073. type: "input",
  1074. prop: "accountOpening",
  1075. label: "账号",
  1076. placeholder: "请输入账号",
  1077. itemWidth: 50,
  1078. isShow:
  1079. formData.data.paymentMethod &&
  1080. (formData.data.paymentMethod.includes("bank") ||
  1081. ["wxPay", "aliPay"].includes(formData.data.paymentMethod))
  1082. ? true
  1083. : false,
  1084. },
  1085. {
  1086. type: "input",
  1087. prop: "remark",
  1088. label: "其他收款方式备注说明",
  1089. itemType: "textarea",
  1090. itemWidth: 100,
  1091. isShow:
  1092. formData.data.paymentMethod &&
  1093. !["bank", "bank1", "阿里巴巴", "wxPay", "aliPay"].includes(
  1094. formData.data.paymentMethod
  1095. )
  1096. ? true
  1097. : false,
  1098. },
  1099. {
  1100. type: "slot",
  1101. slotName: "advanceRatio",
  1102. prop: "",
  1103. label: "",
  1104. },
  1105. // {
  1106. // type: "number",
  1107. // prop: "advanceRatio",
  1108. // label: "定金比例",
  1109. // precision: 2,
  1110. // min: 0,
  1111. // max: 100,
  1112. // controls: false,
  1113. // itemWidth: 25,
  1114. // fn: (val) => {
  1115. // if (val && formData.data.beforeShipmentRatio) {
  1116. // let total = val + formData.data.beforeShipmentRatio;
  1117. // if (total > 100) {
  1118. // formData.data.advanceRatio = null;
  1119. // formData.data.beforeShipmentRatio = null;
  1120. // }
  1121. // formData.data.afterShipmentRatio = 100 - total;
  1122. // }
  1123. // },
  1124. // },
  1125. // {
  1126. // type: "number",
  1127. // prop: "beforeShipmentRatio",
  1128. // label: "出货前付款⽐例",
  1129. // precision: 2,
  1130. // min: 0,
  1131. // max: 100,
  1132. // controls: false,
  1133. // itemWidth: 25,
  1134. // fn: (val) => {
  1135. // if (val && formData.data.advanceRatio) {
  1136. // let total = val + formData.data.advanceRatio;
  1137. // if (total > 100) {
  1138. // formData.data.advanceRatio = null;
  1139. // formData.data.beforeShipmentRatio = null;
  1140. // }
  1141. // formData.data.afterShipmentRatio = 100 - total;
  1142. // }
  1143. // },
  1144. // },
  1145. // {
  1146. // type: "number",
  1147. // prop: "afterShipmentRatio",
  1148. // label: "出货后尾款⽐例",
  1149. // precision: 2,
  1150. // min: 0,
  1151. // max: 100,
  1152. // controls: false,
  1153. // itemWidth: 25,
  1154. // disabled: true,
  1155. // },
  1156. // {
  1157. // type: "input",
  1158. // prop: "remark",
  1159. // label: "付款条件",
  1160. // itemType: "textarea",
  1161. // itemWidth: 100,
  1162. // },
  1163. // {
  1164. // type: "input",
  1165. // prop: "beneficiaryName",
  1166. // label: " ",
  1167. // placeholder: "请输入Beneficiary Name",
  1168. // itemWidth: 50,
  1169. // isShow: formData.data.contractType == "1",
  1170. // },
  1171. // {
  1172. // type: "input",
  1173. // prop: "beneficiaryAccountNumber",
  1174. // label: " ",
  1175. // placeholder: "请输入Beneficiary Account Number",
  1176. // itemWidth: 50,
  1177. // isShow: formData.data.contractType == "1",
  1178. // },
  1179. // {
  1180. // type: "input",
  1181. // prop: "beneficiaryBank",
  1182. // label: " ",
  1183. // placeholder: "请输入Beneficiary Bank",
  1184. // itemWidth: 50,
  1185. // isShow: formData.data.contractType == "1",
  1186. // },
  1187. // {
  1188. // type: "input",
  1189. // prop: "swiftCode",
  1190. // label: " ",
  1191. // placeholder: "请输入Swift Code",
  1192. // itemWidth: 50,
  1193. // isShow: formData.data.contractType == "1",
  1194. // },
  1195. // {
  1196. // type: "input",
  1197. // prop: "beneficiaryBankAddress",
  1198. // label: " ",
  1199. // placeholder: "请输入Beneficiary Bank Address",
  1200. // itemWidth: 50,
  1201. // isShow: formData.data.contractType == "1",
  1202. // },
  1203. // {
  1204. // type: "input",
  1205. // prop: "beneficiaryAddress",
  1206. // label: " ",
  1207. // placeholder: "请输入Beneficiary Address",
  1208. // itemWidth: 50,
  1209. // isShow: formData.data.contractType == "1",
  1210. // },
  1211. // {
  1212. // type: "slot",
  1213. // slotName: "payment",
  1214. // label: "",
  1215. // },
  1216. {
  1217. type: "title",
  1218. title: "交付信息",
  1219. haveLine: true,
  1220. },
  1221. {
  1222. type: "date",
  1223. itemType: "date",
  1224. prop: "saleDate",
  1225. label: "销售日期",
  1226. itemWidth: 50,
  1227. },
  1228. {
  1229. type: "date",
  1230. itemType: "date",
  1231. prop: "deliveryTime",
  1232. label: "交货期限",
  1233. itemWidth: 50,
  1234. },
  1235. // {
  1236. // type: "select",
  1237. // prop: "transportMethod",
  1238. // label: "运输方式",
  1239. // data: shippingMethod.value,
  1240. // itemWidth: 50,
  1241. // },
  1242. // {
  1243. // type: "select",
  1244. // prop: "taxTransportationWay",
  1245. // label: "税运方式",
  1246. // data: taxTransportationWay.value,
  1247. // itemWidth: 50,
  1248. // },
  1249. // {
  1250. // type: "input",
  1251. // prop: "transportRemark",
  1252. // label: "运输说明",
  1253. // itemWidth: 50,
  1254. // },
  1255. // {
  1256. // type: "slot",
  1257. // slotName: "delivery",
  1258. // label: "",
  1259. // },
  1260. {
  1261. type: "title",
  1262. title: "商品信息",
  1263. haveLine: true,
  1264. },
  1265. {
  1266. type: "slot",
  1267. slotName: "commodity",
  1268. label: "",
  1269. },
  1270. // {
  1271. // type: "title",
  1272. // title: "其他收费项目",
  1273. // haveLine: true,
  1274. // },
  1275. // {
  1276. // type: "slot",
  1277. // slotName: "otherCharge",
  1278. // label: "",
  1279. // },
  1280. {
  1281. type: "title",
  1282. title: "订单总金额",
  1283. haveLine: true,
  1284. },
  1285. {
  1286. type: "input",
  1287. prop: "amount",
  1288. label: "订单总⾦额",
  1289. itemWidth: 25,
  1290. disabled: true,
  1291. },
  1292. {
  1293. type: "input",
  1294. prop: "factoryAmount",
  1295. label: "业务总⾦额",
  1296. itemWidth: 25,
  1297. disabled: true,
  1298. },
  1299. {
  1300. type: "input",
  1301. prop: "grossProfit",
  1302. label: "合计⽑利",
  1303. itemWidth: 25,
  1304. disabled: true,
  1305. },
  1306. {
  1307. type: "title",
  1308. title: "合同条款",
  1309. haveLine: true,
  1310. },
  1311. {
  1312. type: "select",
  1313. prop: "contractTemplateId",
  1314. label: "合同条款",
  1315. data: templateList.value,
  1316. itemWidth: 50,
  1317. fn: (val) => {
  1318. proxy.post("/contractTemplate/detail", { id: val }).then((res) => {
  1319. formData.data.templateContent = res.templateContent;
  1320. remarkEditor.value.changeHtml(formData.data.templateContent);
  1321. });
  1322. },
  1323. },
  1324. {
  1325. type: "select",
  1326. prop: "sealUseId",
  1327. label: "用印流水号",
  1328. data: sealUseData.value,
  1329. itemWidth: 50,
  1330. fn: (val) => {},
  1331. },
  1332. {
  1333. type: "slot",
  1334. slotName: "templateContent",
  1335. prop: "templateContent",
  1336. label: "模板内容",
  1337. itemWidth: 100,
  1338. disabled: false,
  1339. },
  1340. {
  1341. type: "title",
  1342. title: "合同上传",
  1343. haveLine: true,
  1344. isShow:
  1345. route.query.processType == 20 || props.queryData.processType == 20,
  1346. },
  1347. {
  1348. type: "slot",
  1349. slotName: "contractFileList",
  1350. prop: "contractFileList",
  1351. label: "合同上传",
  1352. isShow:
  1353. route.query.processType == 20 || props.queryData.processType == 20,
  1354. },
  1355. ];
  1356. });
  1357. const rules = ref({
  1358. ofCompanyId: [
  1359. { required: true, message: "请选择业务公司", trigger: "change" },
  1360. ],
  1361. deptId: [{ required: true, message: "请选择业务部门", trigger: "change" }],
  1362. companyId: [{ required: true, message: "请选择生产公司", trigger: "change" }],
  1363. contractType: [
  1364. { required: true, message: "请选择订单类型", trigger: "change" },
  1365. ],
  1366. processingMethod: [
  1367. { required: true, message: "请选择订单处理方式", trigger: "change" },
  1368. ],
  1369. deliveryTime: [
  1370. { required: true, message: "请选择交货日期", trigger: "change" },
  1371. ],
  1372. belongType: [
  1373. { required: true, message: "请选择订单归属", trigger: "change" },
  1374. ],
  1375. merchUserId: [{ required: true, message: "请选择跟单员", trigger: "change" }],
  1376. salesmanId: [{ required: true, message: "请选择业务员", trigger: "change" }],
  1377. isTax: [{ required: true, message: "请选择是否含税", trigger: "change" }],
  1378. isFreight: [
  1379. { required: true, message: "请选择是否含运费", trigger: "change" },
  1380. ],
  1381. sellCorporationId: [
  1382. { required: true, message: "请选择卖方公司", trigger: "change" },
  1383. ],
  1384. buyCorporationId: [
  1385. { required: true, message: "请选择买方公司", trigger: "change" },
  1386. ],
  1387. countryId: [{ required: true, message: "请选择国家", trigger: "change" }],
  1388. sellAddress: [{ required: true, message: "请输入详细地址", trigger: "blur" }],
  1389. buyAddress: [{ required: true, message: "请输入详细地址", trigger: "blur" }],
  1390. buyContactName: [
  1391. { required: true, message: "请输入联系人", trigger: ["change", "blur"] },
  1392. ],
  1393. // buyContactNumber: [
  1394. // { required: true, message: "请输入联系电话", trigger: "blur" },
  1395. // ],
  1396. quantity: [{ required: true, message: "请输入数量", trigger: "blur" }],
  1397. price: [{ required: true, message: "请输入单价", trigger: "blur" }],
  1398. payName: [
  1399. { required: true, message: "请输入收费项目", trigger: ["change", "blur"] },
  1400. ],
  1401. currency: [{ required: true, message: "请选择币种", trigger: "change" }],
  1402. settlementMethod: [
  1403. { required: true, message: "请选择客户结算方式", trigger: "change" },
  1404. ],
  1405. paymentMethod: [
  1406. { required: true, message: "请选择付款方式", trigger: "change" },
  1407. ],
  1408. advanceRatio: [
  1409. { required: true, message: "请输入预付比例", trigger: "blur" },
  1410. ],
  1411. transportMethod: [
  1412. { required: true, message: "请选择运输方式", trigger: "change" },
  1413. ],
  1414. remark: [
  1415. { required: true, message: "请输入其他收款方式备注说明", trigger: "blur" },
  1416. ],
  1417. rate: [{ required: true, message: "请输入汇率", trigger: "blur" }],
  1418. shroffAccountId: [
  1419. { required: true, message: "请选择收款账号", trigger: "change" },
  1420. ],
  1421. // contractTemplateId: [
  1422. // { required: true, message: "请选择模板", trigger: "change" },
  1423. // ],
  1424. templateContent: [
  1425. { required: true, message: "请输入模板内容", trigger: "blur" },
  1426. ],
  1427. contractChannel: [
  1428. { required: true, message: "请选择订单渠道", trigger: "change" },
  1429. ],
  1430. channelCode: [
  1431. { required: true, message: "请输入订单渠道编号", trigger: "blur" },
  1432. ],
  1433. saleDate: [{ required: true, message: "请选择销售日期", trigger: "change" }],
  1434. taxTransportationWay: [
  1435. { required: true, message: "请选择税运方式", trigger: "change" },
  1436. ],
  1437. beforeShipmentRatio: [
  1438. { required: true, message: "请输入出货前付款比例", trigger: "blur" },
  1439. ],
  1440. afterShipmentRatio: [
  1441. { required: true, message: "请输入出货后付款比例", trigger: "blur" },
  1442. ],
  1443. taxPoints: [{ required: true, message: "请选择税点", trigger: "change" }],
  1444. alibabaCode: [
  1445. { required: true, message: "请输入阿里巴巴编号", trigger: "blur" },
  1446. ],
  1447. alibabaShopName: [
  1448. { required: true, message: "请选择1688店铺名称", trigger: "change" },
  1449. ],
  1450. });
  1451. const getaccountList = (val) => {
  1452. proxy
  1453. .post("/accountManagement/page", {
  1454. pageNum: 1,
  1455. pageSize: 999,
  1456. type: val == "bank1" ? "10" : "20",
  1457. })
  1458. .then((res) => {
  1459. accountList.value = res.rows.map((item) => {
  1460. return {
  1461. ...item,
  1462. label: item.alias,
  1463. value: item.id,
  1464. };
  1465. });
  1466. });
  1467. };
  1468. const isFormDetail = ref(false);
  1469. if (
  1470. (route.query && route.query.processType && route.query.processType == 20) ||
  1471. route.query.currentContractId
  1472. ) {
  1473. isFormDetail.value = true;
  1474. }
  1475. const getDict = () => {
  1476. proxy
  1477. .post("/contractTemplate/page", {
  1478. pageNum: 1,
  1479. pageSize: 999,
  1480. templateType: "1",
  1481. })
  1482. .then((res) => {
  1483. templateList.value = res.rows.map((x) => ({
  1484. label: x.templateName,
  1485. value: x.id,
  1486. }));
  1487. });
  1488. proxy
  1489. .post("/contract/page", {
  1490. pageNum: 1,
  1491. pageSize: 9999,
  1492. notLinkSample: "1",
  1493. })
  1494. .then((res) => {
  1495. sampleData.value = res.rows.map((x) => ({
  1496. label: x.code,
  1497. value: x.id,
  1498. }));
  1499. });
  1500. proxy
  1501. .post("/sealUse/page", {
  1502. pageNum: 1,
  1503. pageSize: 999,
  1504. isLinkContract: isFormDetail.value == true ? "" : 0,
  1505. })
  1506. .then((res) => {
  1507. sealUseData.value = res.rows.map((x) => ({
  1508. label: x.code,
  1509. value: x.id,
  1510. }));
  1511. });
  1512. proxy
  1513. .post("/customer/selPage", {
  1514. pageNum: 1,
  1515. pageSize: 50,
  1516. })
  1517. .then((res) => {
  1518. customerList.value = res.rows.map((x) => ({
  1519. ...x,
  1520. label: x.name,
  1521. value: x.id,
  1522. }));
  1523. });
  1524. proxy.post("/corporation/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  1525. corporationList.value = res.rows.map((item) => {
  1526. return {
  1527. ...item,
  1528. label: item.name,
  1529. value: item.id,
  1530. };
  1531. });
  1532. });
  1533. proxy
  1534. .post("/accountManagement/page", { pageNum: 1, pageSize: 999 })
  1535. .then((res) => {
  1536. accountList.value = res.rows.map((item) => {
  1537. return {
  1538. ...item,
  1539. label: item.alias,
  1540. value: item.id,
  1541. };
  1542. });
  1543. });
  1544. proxy
  1545. .get("/tenantDept/list", {
  1546. pageNum: 1,
  1547. pageSize: 9999,
  1548. keyword: "",
  1549. tenantId: proxy.useUserStore().user.tenantId,
  1550. type: 0,
  1551. })
  1552. .then((res) => {
  1553. treeData.value = proxy.handleTree(res.data, "deptId");
  1554. });
  1555. proxy
  1556. .get(isFormDetail.value ? "/tenantUser/listAll" : "/tenantUser/list", {
  1557. pageNum: 1,
  1558. pageSize: 10000,
  1559. tenantId: proxy.useUserStore().user.tenantId,
  1560. })
  1561. .then((res) => {
  1562. userList.value = res.rows.map((item) => {
  1563. return {
  1564. label: item.nickName,
  1565. value: item.userId,
  1566. };
  1567. });
  1568. });
  1569. };
  1570. const getCityData = (id, type, isChange) => {
  1571. proxy.post("/customizeArea/list", { parentId: id }).then((res) => {
  1572. if (type === "20") {
  1573. provinceData.value = res;
  1574. if (isChange) {
  1575. formData.data.provinceId = "";
  1576. formData.data.provinceName = "";
  1577. formData.data.cityId = "";
  1578. formData.data.cityName = "";
  1579. }
  1580. } else if (type === "30") {
  1581. cityData.value = res;
  1582. if (isChange) {
  1583. formData.data.cityId = "";
  1584. formData.data.cityName = "";
  1585. }
  1586. } else {
  1587. countryData.value = res;
  1588. }
  1589. });
  1590. };
  1591. getDict();
  1592. getCityData("0");
  1593. const handleOfCompanyIdChange = (val) => {
  1594. if (val) {
  1595. proxy
  1596. .get("/tenantDept/list", {
  1597. pageNum: 1,
  1598. pageSize: 9999,
  1599. keyword: "",
  1600. ancestors: isFormDetail.value ? "" : val,
  1601. tenantId: proxy.useUserStore().user.tenantId,
  1602. // type: 2,
  1603. })
  1604. .then((res) => {
  1605. deptData.value = proxy.handleTree(res.data, "deptId");
  1606. });
  1607. }
  1608. };
  1609. const sellCorporationIdChange = (val) => {
  1610. if (val) {
  1611. proxy.post("/corporation/detail", { id: val }).then((res) => {
  1612. formData.data.sellCountryName = res.countryName;
  1613. formData.data.sellProvinceName = res.provinceName;
  1614. formData.data.sellCityName = res.cityName;
  1615. formData.data.sellAddress = res.address;
  1616. formData.data.sellContactName = res.contactName;
  1617. formData.data.sellContactNumber = res.contactPhone;
  1618. // if (formData.data.contractType == "2") {
  1619. // formData.data.sellCountryName = res.countryName;
  1620. // formData.data.sellProvinceName = res.provinceName;
  1621. // formData.data.sellCityName = res.cityName;
  1622. // formData.data.sellAddress = res.address;
  1623. // formData.data.sellContactName = res.contactName;
  1624. // formData.data.sellContactNumber = res.contactPhone;
  1625. // } else {
  1626. // formData.data.sellCountryName = res.countryEnStr;
  1627. // formData.data.sellProvinceName = res.provinceEnStr;
  1628. // formData.data.sellCityName = res.cityEnStr;
  1629. // formData.data.sellAddress = res.addressEn;
  1630. // formData.data.sellContactName = res.contactName;
  1631. // formData.data.sellContactNumber = res.contactPhone;
  1632. // }
  1633. });
  1634. }
  1635. };
  1636. const changeCustomer = (val) => {
  1637. // formData.data.contractProductList = [];
  1638. if (val) {
  1639. proxy.post("/customer/detail", { id: val }).then(
  1640. (res) => {
  1641. formData.data.buyCorporationName = res.name;
  1642. formData.data.settlementMethod = res.settlementMode;
  1643. if (res.customerUserList && res.customerUserList.length > 0) {
  1644. formData.data.buyContactName = res.customerUserList[0].name;
  1645. formData.data.buyContactNumber = res.customerUserList[0].phone;
  1646. // if (res.customerUserList[0].contactJson) {
  1647. // let contactJson = JSON.parse(res.customerUserList[0].contactJson);
  1648. // if (contactJson && contactJson.length > 0) {
  1649. // formData.data.buyContactNumber = contactJson[0].contactNo;
  1650. // }
  1651. // }
  1652. customerUserList.value = res.customerUserList.map((item) => {
  1653. return {
  1654. ...item,
  1655. value: item.name,
  1656. };
  1657. });
  1658. }
  1659. // 回填客户的账户信息
  1660. // formData.data.beneficiaryName = res.beneficiaryName;
  1661. // formData.data.beneficiaryBank = res.beneficiaryBank;
  1662. // formData.data.beneficiaryBankAddress = res.beneficiaryBankAddress;
  1663. // formData.data.beneficiaryAccountNumber = res.beneficiaryAccountNumber;
  1664. // formData.data.swiftCode = res.swiftCode;
  1665. // formData.data.beneficiaryAddress = res.beneficiaryAddress;
  1666. formData.data.countryId = res.countryId;
  1667. formData.data.provinceId = res.provinceId;
  1668. formData.data.cityId = res.cityId;
  1669. formData.data.buyPostalCode = res.zipCode;
  1670. formData.data.buyAddress = res.address;
  1671. getCityData(formData.data.countryId, "20");
  1672. if (formData.data.provinceId) {
  1673. getCityData(formData.data.provinceId, "30");
  1674. }
  1675. },
  1676. (err) => {
  1677. formData.data.countryId = "";
  1678. formData.data.provinceId = "";
  1679. formData.data.cityId = "";
  1680. formData.data.buyPostalCode = "";
  1681. formData.data.buyAddress = "";
  1682. }
  1683. );
  1684. } else {
  1685. formData.data.countryId = "";
  1686. formData.data.provinceId = "";
  1687. formData.data.cityId = "";
  1688. formData.data.buyPostalCode = "";
  1689. formData.data.buyAddress = "";
  1690. }
  1691. };
  1692. const changeAdvanceRatio = (val, flag) => {
  1693. if (flag) {
  1694. let total = Number(
  1695. parseFloat(val + Number(formData.data.beforeShipmentRatio)).toFixed(2)
  1696. );
  1697. if (total > 100) {
  1698. formData.data.advanceRatio = null;
  1699. formData.data.beforeShipmentRatio = null;
  1700. formData.data.afterShipmentRatio = null;
  1701. } else {
  1702. formData.data.afterShipmentRatio = Number(
  1703. parseFloat(100 - total).toFixed(2)
  1704. );
  1705. }
  1706. } else {
  1707. let total = Number(
  1708. parseFloat(val + Number(formData.data.advanceRatio)).toFixed(2)
  1709. );
  1710. if (total > 100) {
  1711. formData.data.advanceRatio = null;
  1712. formData.data.beforeShipmentRatio = null;
  1713. formData.data.afterShipmentRatio = null;
  1714. } else {
  1715. formData.data.afterShipmentRatio = Number(
  1716. parseFloat(100 - total).toFixed(2)
  1717. );
  1718. }
  1719. }
  1720. };
  1721. const createFilter = (queryString) => {
  1722. return (restaurant) => {
  1723. return (
  1724. restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0
  1725. );
  1726. };
  1727. };
  1728. const querySearchPerson = (queryString, callback) => {
  1729. const results = queryString
  1730. ? customerUserList.value.filter(createFilter(queryString))
  1731. : customerUserList.value;
  1732. callback(results);
  1733. };
  1734. const handlePerson = (item) => {
  1735. if (item.contactJson) {
  1736. let data = JSON.parse(item.contactJson);
  1737. formData.data.buyContactNumber = data[0].contactNo;
  1738. }
  1739. };
  1740. const handleClickSelectMaterial = (index) => {
  1741. indexValue.value = index;
  1742. openSelectMaterial.value = true;
  1743. };
  1744. const contractProductBomList = ref([]);
  1745. const selectProduct = async (goods) => {
  1746. if (goods && goods.id) {
  1747. let rowId = uuidv4();
  1748. let allFile = [];
  1749. let fileUrl = "";
  1750. if (goods.fileList && goods.fileList.length > 0) {
  1751. fileUrl = goods.fileList[0].fileUrl;
  1752. }
  1753. const fileData = await proxy.post("/fileInfo/getList", {
  1754. businessIdList: [goods.id],
  1755. });
  1756. if (fileData[goods.id] && fileData[goods.id].length > 0) {
  1757. allFile = fileData[goods.id];
  1758. } else {
  1759. allFile = [];
  1760. }
  1761. proxy.post("/productBomInfo/detail", { id: goods.id }).then((res) => {
  1762. if (res.productBomDetailList && res.productBomDetailList.length > 0) {
  1763. contractProductBomList.value = res.productBomDetailList.map((x) => ({
  1764. fileUrl: "",
  1765. materialId: x.materialId,
  1766. productName: x.materialName,
  1767. productCode: x.materialCode,
  1768. productLength: x.materialLength,
  1769. productWidth: x.materialWidth,
  1770. productHeight: x.materialHeight,
  1771. productColor: x.materialColor,
  1772. standardDosage: x.standardDosage,
  1773. lossRate: x.lossRate,
  1774. remark: x.remark || "",
  1775. quantity: x.type != 3 ? null : 1,
  1776. allQuantity: "",
  1777. price: x.materialPrice || null,
  1778. amount: "",
  1779. fileList: [],
  1780. type: x.type,
  1781. oldId: x.id,
  1782. }));
  1783. let fileListOne = [];
  1784. if (allFile && allFile.length > 0) {
  1785. fileListOne = allFile.filter((x) => x.businessType == "2");
  1786. }
  1787. formData.data.contractProductList.push({
  1788. fileUrl: fileUrl,
  1789. productId: goods.id,
  1790. productClassifyName: goods.classifyName,
  1791. productName: goods.name,
  1792. productCode: goods.customCode,
  1793. productLength: goods["length"],
  1794. productWidth: goods.width,
  1795. productHeight: goods.height,
  1796. productColor: goods.color,
  1797. productNetWeight: goods.netWeight,
  1798. productUnit: goods.unit,
  1799. productFrontalTexture: goods.frontalTexture,
  1800. prodFilePath: goods.prodFilePath,
  1801. quantity: null,
  1802. price: goods.price || null,
  1803. businessCostPrice: goods.businessCostPrice || null,
  1804. factoryPrice: goods.factoryPrice || null,
  1805. amount: "",
  1806. remark: "",
  1807. fileList: [],
  1808. isShowProductFile: true,
  1809. fileListOne: fileListOne,
  1810. prodFileList: [],
  1811. contractProductBomList: contractProductBomList.value,
  1812. rowId: rowId,
  1813. });
  1814. proxy.msgTip("添加成功", 1);
  1815. changeProductPrice();
  1816. let bomIds = contractProductBomList.value.map((x) => x.materialId);
  1817. let bomIdsOne = contractProductBomList.value.map((x) => x.oldId);
  1818. // 取物料图片
  1819. proxy
  1820. .getFileData({ businessIdList: bomIds, getAll: true })
  1821. .then((res) => {
  1822. for (let i = 0; i < contractProductBomList.value.length; i++) {
  1823. const iele = contractProductBomList.value[i];
  1824. let fileData = res[iele.materialId] || [];
  1825. if (fileData && fileData.length > 0) {
  1826. iele.fileList = fileData
  1827. .filter((x) => x.businessType == "0")
  1828. .map((y) => ({ ...y, name: y.fileName, url: y.fileUrl }));
  1829. if (iele.fileList && iele.fileList.length > 0) {
  1830. iele.fileUrl = iele.fileList[0].fileUrl;
  1831. }
  1832. } else {
  1833. iele.fileList = [];
  1834. }
  1835. }
  1836. });
  1837. // 取bom附件
  1838. proxy
  1839. .getFileData({ businessIdList: bomIdsOne, getAll: true })
  1840. .then((res) => {
  1841. for (let i = 0; i < contractProductBomList.value.length; i++) {
  1842. const iele = contractProductBomList.value[i];
  1843. let fileData = res[iele.oldId] || [];
  1844. if (fileData && fileData.length > 0) {
  1845. iele.bomFileList = fileData
  1846. .filter((x) => x.businessType == "10")
  1847. .map((y) => ({ ...y, name: y.fileName, url: y.fileUrl }));
  1848. } else {
  1849. iele.bomFileList = [];
  1850. }
  1851. }
  1852. });
  1853. } else {
  1854. return proxy.msgTip("该产品未配置BOM", 2);
  1855. }
  1856. });
  1857. } else {
  1858. return proxy.msgTip("选择错误", 2);
  1859. }
  1860. };
  1861. // const selectMaterial = (goods) => {
  1862. // let flag = formData.data.contractProductList[
  1863. // indexValue.value
  1864. // ].contractProductBomList.some((x) => x.materialId == goods.id);
  1865. // if (!flag) {
  1866. // let fileUrl = "";
  1867. // if (goods.fileList && goods.fileList.length > 0) {
  1868. // fileUrl = goods.fileList[0].fileUrl;
  1869. // }
  1870. // formData.data.contractProductList[
  1871. // indexValue.value
  1872. // ].contractProductBomList.push({
  1873. // fileUrl: fileUrl,
  1874. // materialId: goods.id,
  1875. // productName: goods.name,
  1876. // productCode: goods.customCode,
  1877. // productLength: goods["length"],
  1878. // productWidth: goods.width,
  1879. // productHeight: goods.height,
  1880. // quantity: null,
  1881. // price: goods.price || null,
  1882. // amount: "",
  1883. // fileList: [],
  1884. // type: 2,
  1885. // });
  1886. // proxy.msgTip("选择成功");
  1887. // } else {
  1888. // proxy.msgTip("该物料已选择", 2);
  1889. // }
  1890. // };
  1891. const selectMaterial = (goods) => {
  1892. let flag = formData.data.contractProductList[
  1893. indexValue.value
  1894. ].contractProductBomList.some((x) => x.materialId == goods.id);
  1895. if (!flag) {
  1896. let fileUrl = "";
  1897. if (goods.fileList && goods.fileList.length > 0) {
  1898. fileUrl = goods.fileList[0].fileUrl;
  1899. }
  1900. formData.data.contractProductList[
  1901. indexValue.value
  1902. ].contractProductBomList.push({
  1903. fileUrl: fileUrl,
  1904. materialId: goods.id,
  1905. productName: goods.name,
  1906. productCode: goods.customCode,
  1907. productLength: goods["length"],
  1908. productWidth: goods.width,
  1909. productHeight: goods.height,
  1910. productColor: goods.color,
  1911. quantity: null,
  1912. standardDosage: 1,
  1913. lossRate: null,
  1914. remark: "",
  1915. price: null,
  1916. amount: "",
  1917. fileList: [],
  1918. type: 2,
  1919. });
  1920. proxy.msgTip("选择成功");
  1921. } else {
  1922. proxy.msgTip("该物料已选择", 2);
  1923. }
  1924. };
  1925. const changeProductPrice = () => {
  1926. return;
  1927. let productIds = formData.data.contractProductList.map((x) => x.productId);
  1928. if (productIds && productIds.length > 0) {
  1929. proxy
  1930. .post("/contract/getProductPriceInfo", {
  1931. productIds: productIds,
  1932. customerId: formData.data.buyCorporationId
  1933. ? formData.data.buyCorporationId
  1934. : "",
  1935. })
  1936. .then((res) => {
  1937. for (let i = 0; i < formData.data.contractProductList.length; i++) {
  1938. const iele = formData.data.contractProductList[i];
  1939. for (const key in res) {
  1940. if (key == iele.productId) {
  1941. iele.salePrice = res[key].price;
  1942. iele.currency = res[key].currency;
  1943. iele.saleCostPrice = res[key].costPrice;
  1944. iele.contractProductList = res[key].contractProductList
  1945. .map((x) => ({
  1946. createTime: x.createTime || "",
  1947. price: x.price,
  1948. currency: x.currency,
  1949. }))
  1950. .filter((y, index) => index < 3);
  1951. iele.contractProductListOne = res[key].contractProductList.map(
  1952. (x) => ({
  1953. createTime: x.createTime || "",
  1954. price: x.price,
  1955. currency: x.currency,
  1956. })
  1957. );
  1958. iele.customerContractProductList = res[
  1959. key
  1960. ].customerContractProductList.map((x) => ({
  1961. createTime: x.createTime || "",
  1962. price: x.price,
  1963. currency: x.currency,
  1964. }));
  1965. }
  1966. }
  1967. }
  1968. });
  1969. }
  1970. };
  1971. const updateContent = (val) => {
  1972. formData.data.templateContent = val;
  1973. };
  1974. const onPicture = (path) => {
  1975. window.open(path, "_blank");
  1976. };
  1977. const handleRemove = (index) => {
  1978. formData.data.contractProductList.splice(index, 1);
  1979. totalAmount();
  1980. };
  1981. const handleDeleteMaterial = (index, sonIndex) => {
  1982. formData.data.contractProductList[index].contractProductBomList.splice(
  1983. sonIndex,
  1984. 1
  1985. );
  1986. };
  1987. const calculationAmount = (flag = false) => {
  1988. if (
  1989. formData.data.contractProductList &&
  1990. formData.data.contractProductList.length > 0
  1991. ) {
  1992. for (let i = 0; i < formData.data.contractProductList.length; i++) {
  1993. formData.data.contractProductList[i].amount = parseFloat(
  1994. Number(formData.data.contractProductList[i].quantity) *
  1995. Number(formData.data.contractProductList[i].price)
  1996. ).toFixed(2);
  1997. formData.data.contractProductList[i].amountTwo = parseFloat(
  1998. Number(formData.data.contractProductList[i].quantity) *
  1999. Number(formData.data.contractProductList[i].factoryPrice)
  2000. ).toFixed(2);
  2001. let row = formData.data.contractProductList[i];
  2002. if (flag && row.quantity) {
  2003. for (let j = 0; j < row.contractProductBomList.length; j++) {
  2004. let jrow = row.contractProductBomList[j];
  2005. if (jrow.standardDosage && jrow.lossRate != null) {
  2006. jrow.quantity = Math.ceil(
  2007. Number(
  2008. parseFloat(
  2009. (row.quantity / jrow.standardDosage) *
  2010. (1 + jrow.lossRate / 100)
  2011. ).toFixed(2)
  2012. )
  2013. );
  2014. }
  2015. }
  2016. }
  2017. }
  2018. }
  2019. totalAmount();
  2020. };
  2021. const totalAmount = () => {
  2022. let money = 0;
  2023. let moneyTwo = 0;
  2024. if (
  2025. formData.data.contractProductList &&
  2026. formData.data.contractProductList.length > 0
  2027. ) {
  2028. for (let i = 0; i < formData.data.contractProductList.length; i++) {
  2029. if (formData.data.contractProductList[i].amount) {
  2030. money = parseFloat(
  2031. Number(money) + Number(formData.data.contractProductList[i].amount)
  2032. ).toFixed(2);
  2033. }
  2034. if (formData.data.contractProductList[i].amountTwo) {
  2035. moneyTwo = parseFloat(
  2036. Number(moneyTwo) +
  2037. Number(formData.data.contractProductList[i].amountTwo)
  2038. ).toFixed(2);
  2039. }
  2040. }
  2041. }
  2042. if (
  2043. formData.data.contractProjectList &&
  2044. formData.data.contractProjectList.length > 0
  2045. ) {
  2046. for (let i = 0; i < formData.data.contractProjectList.length; i++) {
  2047. if (formData.data.contractProjectList[i].amount) {
  2048. money = parseFloat(
  2049. Number(money) + Number(formData.data.contractProjectList[i].amount)
  2050. ).toFixed(2);
  2051. }
  2052. }
  2053. }
  2054. formData.data.amount = money;
  2055. formData.data.factoryAmount = moneyTwo;
  2056. formData.data.grossProfit = parseFloat(
  2057. Number(formData.data.amount) - Number(formData.data.factoryAmount)
  2058. ).toFixed(2);
  2059. };
  2060. const clickAdd = () => {
  2061. if (
  2062. formData.data.contractProjectList &&
  2063. formData.data.contractProjectList.length > 0
  2064. ) {
  2065. formData.data.contractProjectList.push({
  2066. payName: "",
  2067. amount: null,
  2068. remark: "",
  2069. });
  2070. } else {
  2071. formData.data.contractProjectList = [
  2072. { payName: "", amount: null, remark: "" },
  2073. ];
  2074. }
  2075. };
  2076. const handleDelete = (index) => {
  2077. formData.data.contractProjectList.splice(index, 1);
  2078. totalAmount();
  2079. };
  2080. const querySearch = (queryString, callback) => {
  2081. proxy.post("/quotationPay/page", { payName: queryString }).then((res) => {
  2082. if (res.rows && res.rows.length > 0) {
  2083. res.rows = res.rows.map((item) => {
  2084. return {
  2085. ...item,
  2086. value: item.payName,
  2087. };
  2088. });
  2089. callback(res.rows);
  2090. } else {
  2091. callback([]);
  2092. }
  2093. });
  2094. };
  2095. const handleBeforeUpload = async (file, index) => {
  2096. formData.data.contractProductList[index].imgLoading = true;
  2097. const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
  2098. uploadData.value = res.uploadBody;
  2099. formData.data.contractProductList[index].fileList = [
  2100. {
  2101. id: res.id,
  2102. fileName: res.fileName,
  2103. fileUrl: res.fileUrl,
  2104. uploadState: false,
  2105. },
  2106. ];
  2107. formData.data.contractProductList[index].fileData = res;
  2108. return true;
  2109. };
  2110. const handleBeforeUploadOne = async (file, index) => {
  2111. const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
  2112. file.id = res.id;
  2113. file.fileUrl = res.fileUrl;
  2114. uploadData.value = res.uploadBody;
  2115. formData.data.contractProductList[index].fileData = res;
  2116. return true;
  2117. };
  2118. const handleSuccess = (index) => {
  2119. if (
  2120. formData.data.contractProductList[index].fileData &&
  2121. formData.data.contractProductList[index].fileData.fileUrl
  2122. ) {
  2123. formData.data.contractProductList[index].uploadState = true;
  2124. formData.data.contractProductList[index].imageUrl =
  2125. formData.data.contractProductList[index].fileData.fileUrl;
  2126. }
  2127. setTimeout(() => {
  2128. formData.data.contractProductList[index].imgLoading = false;
  2129. }, 400);
  2130. };
  2131. const handleSuccessOne = (index) => {
  2132. if (
  2133. formData.data.contractProductList[index].fileData &&
  2134. formData.data.contractProductList[index].fileData.fileUrl
  2135. ) {
  2136. let file = formData.data.contractProductList[index].fileData;
  2137. formData.data.contractProductList[index].prodFileList.push({
  2138. id: file.id,
  2139. fileName: file.fileName,
  2140. name: file.fileName,
  2141. url: file.fileUrl,
  2142. fileUrl: file.fileUrl,
  2143. });
  2144. formData.data.contractProductList[index].fileData = {};
  2145. }
  2146. };
  2147. const handleRemoveFile = (file, index) => {
  2148. let sonIndex = formData.data.contractProductList[
  2149. index
  2150. ].prodFileList.findIndex((x) => x.id == file.id || x.id == file.raw.id);
  2151. if (sonIndex > -1) {
  2152. formData.data.contractProductList[index].prodFileList.splice(sonIndex, 1);
  2153. }
  2154. };
  2155. const onPreviewFile = (file) => {
  2156. if (file && file.fileUrl) {
  2157. window.open(file.fileUrl, "_blank");
  2158. } else {
  2159. window.open(file.raw.fileUrl, "_blank");
  2160. }
  2161. };
  2162. const loadingSearch = ref(false);
  2163. const remoteMethod = (keyword) => {
  2164. if (keyword && typeof keyword === "string") {
  2165. loadingSearch.value = true;
  2166. proxy.post("/customer/selPage", { keyword }).then((res) => {
  2167. customerList.value = res.rows.map((x) => ({
  2168. ...x,
  2169. label: x.name,
  2170. value: x.id,
  2171. }));
  2172. loadingSearch.value = false;
  2173. });
  2174. }
  2175. return;
  2176. };
  2177. const handleSubmit = async (isStag = false) => {
  2178. if (isStag) {
  2179. return true;
  2180. }
  2181. let flag = await formDom.value.handleSubmit(() => {});
  2182. if (flag) {
  2183. if (
  2184. formData.data.contractProductList &&
  2185. formData.data.contractProductList.length > 0
  2186. ) {
  2187. for (let i = 0; i < formData.data.contractProductList.length; i++) {
  2188. const ele = formData.data.contractProductList[i];
  2189. if (
  2190. ele.isShowProductFile &&
  2191. ele.fileListOne &&
  2192. ele.fileListOne.length > 0
  2193. ) {
  2194. ele.prodFileList = ele.fileListOne;
  2195. }
  2196. }
  2197. formData.data.currency = currencyData.value[0].dictKey;
  2198. return true;
  2199. } else {
  2200. proxy.msgTip("请添加至少一件商品", 2);
  2201. return false;
  2202. }
  2203. } else {
  2204. // setTimeout(() => {
  2205. // const errorDiv = document.getElementsByClassName("is-error");
  2206. // errorDiv[0].scrollIntoView();
  2207. // }, 0);
  2208. isShowOther.value = true;
  2209. }
  2210. return flag;
  2211. };
  2212. const getFormData = () => {
  2213. // 赋值类型
  2214. formData.data.type = route.query.flowKey == "sample_flow" ? "1" : "0";
  2215. return proxy.deepClone(formData.data);
  2216. };
  2217. // 向父组件暴露
  2218. defineExpose({
  2219. getFormData,
  2220. handleSubmit,
  2221. });
  2222. const changeShroffAccount = (val) => {
  2223. if (val) {
  2224. let data = accountList.value.find((item) => item.value == val);
  2225. if (data) {
  2226. formData.data.beneficiaryName = "";
  2227. formData.data.beneficiaryBank = "";
  2228. formData.data.beneficiaryBankAddress = "";
  2229. formData.data.beneficiaryAccountNumber = "";
  2230. formData.data.swiftCode = "";
  2231. formData.data.beneficiaryAddress = "";
  2232. formData.data.accountName = data.name;
  2233. formData.data.openingBank = data.openingBank;
  2234. formData.data.accountOpening = data.accountOpening;
  2235. }
  2236. // if (formData.data.contractType == "2") {
  2237. // if (data) {
  2238. // formData.data.beneficiaryName = "";
  2239. // formData.data.beneficiaryBank = "";
  2240. // formData.data.beneficiaryBankAddress = "";
  2241. // formData.data.beneficiaryAccountNumber = "";
  2242. // formData.data.swiftCode = "";
  2243. // formData.data.beneficiaryAddress = "";
  2244. // formData.data.accountName = data.name;
  2245. // formData.data.openingBank = data.openingBank;
  2246. // formData.data.accountOpening = data.accountOpening;
  2247. // }
  2248. // } else {
  2249. // if (data) {
  2250. // formData.data.accountName = "";
  2251. // formData.data.openingBank = "";
  2252. // formData.data.accountOpening = "";
  2253. // formData.data.beneficiaryName = data.beneficiaryName;
  2254. // formData.data.beneficiaryBank = data.beneficiaryBank;
  2255. // formData.data.beneficiaryBankAddress = data.beneficiaryBankAddress;
  2256. // formData.data.beneficiaryAccountNumber = data.beneficiaryAccountNumber;
  2257. // formData.data.swiftCode = data.swiftCode;
  2258. // formData.data.beneficiaryAddress = data.beneficiaryAddress;
  2259. // }
  2260. // }
  2261. }
  2262. };
  2263. const handleClickUpload = async (att, flag, index) => {
  2264. let res = null;
  2265. let path = "";
  2266. if (flag) {
  2267. proxy.msgTip("请稍后", 2);
  2268. res = await proxy.post("/fileService/createTempFolder");
  2269. if (res && res.path) {
  2270. formData.data.contractProductList[index][att] = res.path;
  2271. path = res.path;
  2272. }
  2273. } else {
  2274. path = formData.data.contractProductList[index][att];
  2275. }
  2276. let a = document.createElement("a");
  2277. a.href = "printer://" + `ftp://${import.meta.env.VITE_APP_IP}/` + path + "/";
  2278. a.style.display = "none";
  2279. document.body.appendChild(a);
  2280. a.click();
  2281. document.body.removeChild(a);
  2282. };
  2283. const handleClickUploadOne = (index) => {
  2284. formData.data.contractProductList[index].isShowProductFile =
  2285. !formData.data.contractProductList[index].isShowProductFile;
  2286. if (formData.data.contractProductList[index].isShowProductFile) {
  2287. formData.data.contractProductList[index].prodFileList = [];
  2288. formData.data.contractProductList[index].fileData = {};
  2289. }
  2290. };
  2291. const dialogOpenType = ref(-1);
  2292. const openSelectRawMaterial = ref(false);
  2293. const openSelectTechnology = ref(false);
  2294. const openDialog = (index, type) => {
  2295. indexValue.value = index;
  2296. dialogOpenType.value = type;
  2297. if (type == 1) {
  2298. openSelectRawMaterial.value = true;
  2299. }
  2300. if (type == 2) {
  2301. openSelectTechnology.value = true;
  2302. }
  2303. if (type == 3) {
  2304. handleClickSelectMaterial(index);
  2305. }
  2306. };
  2307. const selectRawMaterial = (row) => {
  2308. if (dialogOpenType.value == 1) {
  2309. let flag = formData.data.contractProductList[
  2310. indexValue.value
  2311. ].contractProductBomList.some((x) => x.materialId == row.id);
  2312. if (!flag) {
  2313. formData.data.contractProductList[
  2314. indexValue.value
  2315. ].contractProductBomList.unshift({
  2316. materialId: row.id,
  2317. type: 1,
  2318. productName: row.name,
  2319. productCode: row.customCode,
  2320. productLength: row["length"],
  2321. productWidth: row.width,
  2322. productHeight: row.height,
  2323. productColor: row.color,
  2324. quantity: null,
  2325. standardDosage: 1,
  2326. lossRate: null,
  2327. remark: "",
  2328. price: null,
  2329. amount: "",
  2330. fileList: [],
  2331. });
  2332. proxy.msgTip("选择成功");
  2333. } else {
  2334. proxy.msgTip("该物料已选择", 2);
  2335. }
  2336. }
  2337. };
  2338. const selectTechnology = (row) => {
  2339. if (
  2340. dialogOpenType.value == 2 &&
  2341. row.processRouteList &&
  2342. row.processRouteList.length > 0
  2343. ) {
  2344. formData.data.contractProductList[indexValue.value].technologyId = row.id;
  2345. formData.data.contractProductList[indexValue.value].contractProductBomList =
  2346. formData.data.contractProductList[
  2347. indexValue.value
  2348. ].contractProductBomList.filter((x) => x.type != 3);
  2349. let index = formData.data.contractProductList[
  2350. indexValue.value
  2351. ].contractProductBomList.findIndex((x) => x.type == 2);
  2352. let arr = row.processRouteList.map((x) => ({
  2353. type: 3,
  2354. materialId: x.id,
  2355. productName: x.name,
  2356. productCode: x.code,
  2357. quantity: null,
  2358. standardDosage: 1,
  2359. lossRate: null,
  2360. remark: "",
  2361. }));
  2362. if (index >= 0) {
  2363. formData.data.contractProductList[
  2364. indexValue.value
  2365. ].contractProductBomList.splice(index, 0, ...arr);
  2366. } else {
  2367. let arrLength =
  2368. formData.data.contractProductList[indexValue.value]
  2369. .contractProductBomList.length;
  2370. formData.data.contractProductList[
  2371. indexValue.value
  2372. ].contractProductBomList.splice(arrLength ? arrLength : 0, 0, ...arr);
  2373. }
  2374. openSelectTechnology.value = false;
  2375. return proxy.msgTip("选择成功", 1);
  2376. }
  2377. };
  2378. const getAllData = (businessId) => {
  2379. proxy.post("/contract/detail", { id: businessId }).then(async (res) => {
  2380. res.countryId = res.buyCountryId;
  2381. res.provinceId = res.buyProvinceId;
  2382. res.cityId = res.buyCityId;
  2383. if (res.grossProfitInfoList && res.grossProfitInfoList.length > 0) {
  2384. $bus.emit("getGrossData", res.grossProfitInfoList);
  2385. }
  2386. for (const key in res) {
  2387. formData.data[key] = res[key];
  2388. }
  2389. formData.data.belongType = formData.data.belongType + "";
  2390. formData.data.isFreight = formData.data.isFreight + "";
  2391. formData.data.isTax = formData.data.isTax + "";
  2392. remarkEditor.value.changeHtml(formData.data.templateContent);
  2393. // 外层附件回显
  2394. proxy
  2395. .post("/fileInfo/getList", { businessIdList: [businessId] })
  2396. .then((fileObj) => {
  2397. if (fileObj[businessId] && fileObj[businessId].length > 0) {
  2398. formData.data.contractFileList = fileObj[businessId]
  2399. .filter((x) => x.businessType == "10")
  2400. .map((item) => {
  2401. return {
  2402. ...item,
  2403. name: item.fileName,
  2404. url: item.fileUrl,
  2405. };
  2406. });
  2407. } else {
  2408. formData.data.contractFileList = [];
  2409. }
  2410. });
  2411. if (
  2412. formData.data.contractProductList &&
  2413. formData.data.contractProductList.length > 0
  2414. ) {
  2415. getFileData();
  2416. let productIds = formData.data.contractProductList.map(
  2417. (x) => x.productId
  2418. );
  2419. // proxy.getFileData({
  2420. // businessIdList: productIds,
  2421. // data: formData.data.contractProductList,
  2422. // att: "productId",
  2423. // businessType: "0",
  2424. // fileAtt: "productFile",
  2425. // filePathAtt: "fileUrl",
  2426. // });
  2427. const productAllFile = await proxy.getFileData({
  2428. businessIdList: productIds,
  2429. getAll: true,
  2430. });
  2431. let bomIds = [];
  2432. for (let i = 0; i < formData.data.contractProductList.length; i++) {
  2433. const ele = formData.data.contractProductList[i];
  2434. ele.rowId = uuidv4();
  2435. for (const key in productAllFile) {
  2436. if (
  2437. ele.productId == key &&
  2438. productAllFile[ele.productId] &&
  2439. productAllFile[ele.productId].length > 0
  2440. ) {
  2441. ele.productFile = productAllFile[ele.productId].filter(
  2442. (x) => x.businessType == "0"
  2443. );
  2444. if (ele.productFile && ele.productFile.length > 0) {
  2445. ele.fileUrl = ele.productFile[0].fileUrl;
  2446. }
  2447. break;
  2448. }
  2449. }
  2450. for (let j = 0; j < ele.contractProductBomList.length; j++) {
  2451. const jele = ele.contractProductBomList[j];
  2452. bomIds.push(jele.id);
  2453. }
  2454. }
  2455. // 获取bom文件
  2456. proxy
  2457. .getFileData({ businessIdList: bomIds, getAll: true })
  2458. .then((res) => {
  2459. for (let i = 0; i < formData.data.contractProductList.length; i++) {
  2460. const iele = formData.data.contractProductList[i];
  2461. for (let j = 0; j < iele.contractProductBomList.length; j++) {
  2462. const jele = iele.contractProductBomList[j];
  2463. let fileData = res[jele.id] || [];
  2464. if (fileData && fileData.length > 0) {
  2465. jele.bomFileList = fileData
  2466. .filter((x) => x.businessType == "10")
  2467. .map((y) => ({ ...y, name: y.fileName, url: y.fileUrl }));
  2468. } else {
  2469. jele.bomFileList = [];
  2470. }
  2471. }
  2472. }
  2473. });
  2474. let ids = formData.data.contractProductList.map((x) => x.id);
  2475. proxy
  2476. .getFileData({
  2477. businessIdList: ids,
  2478. getAll: true,
  2479. })
  2480. .then((fileObj) => {
  2481. if (fileObj && Object.keys(fileObj).length > 0) {
  2482. for (let i = 0; i < formData.data.contractProductList.length; i++) {
  2483. const ele = formData.data.contractProductList[i];
  2484. for (const key in fileObj) {
  2485. if (
  2486. ele.id == key &&
  2487. fileObj[ele.id] &&
  2488. fileObj[ele.id].length > 0
  2489. ) {
  2490. let imageUrlList = fileObj[ele.id].filter(
  2491. (x) => x.businessType == "0"
  2492. );
  2493. if (imageUrlList && imageUrlList.length > 0) {
  2494. ele.imageUrl = imageUrlList[0].fileUrl;
  2495. }
  2496. ele.prodFileList = fileObj[ele.id]
  2497. .filter((x) => x.businessType == "1")
  2498. .map((x) => ({ ...x, name: x.fileName, url: x.fileUrl }));
  2499. if (ele.prodFileList && ele.prodFileList.length > 0) {
  2500. ele.isShowProductFile = false;
  2501. } else {
  2502. ele.isShowProductFile = true;
  2503. if (productAllFile[ele.productId]) {
  2504. ele.fileListOne = productAllFile[ele.productId].filter(
  2505. (x) => x.businessType == "2"
  2506. );
  2507. }
  2508. }
  2509. }
  2510. }
  2511. }
  2512. } else {
  2513. for (let i = 0; i < formData.data.contractProductList.length; i++) {
  2514. const ele = formData.data.contractProductList[i];
  2515. ele.isShowProductFile = true;
  2516. for (const key in productAllFile) {
  2517. if (
  2518. ele.productId == key &&
  2519. productAllFile[ele.productId] &&
  2520. productAllFile[ele.productId].length > 0
  2521. ) {
  2522. ele.fileListOne = productAllFile[ele.productId].filter(
  2523. (x) => x.businessType == "2"
  2524. );
  2525. break;
  2526. }
  2527. }
  2528. }
  2529. }
  2530. });
  2531. changeProductPrice();
  2532. }
  2533. calculationAmount(true);
  2534. if (formData.data.countryId) {
  2535. getCityData(formData.data.countryId, "20");
  2536. }
  2537. if (formData.data.provinceId) {
  2538. getCityData(formData.data.provinceId, "30");
  2539. }
  2540. });
  2541. };
  2542. const getFileData = () => {
  2543. let ids = [];
  2544. formData.data.contractProductList.map((x) => {
  2545. // ids.push(x.productId);
  2546. x.contractProductBomList.map((y) => {
  2547. ids.push(y.materialId);
  2548. });
  2549. });
  2550. ids = Array.from(new Set(ids));
  2551. proxy
  2552. .post("/fileInfo/getList", {
  2553. businessIdList: ids,
  2554. })
  2555. .then((fileObj) => {
  2556. formData.data.contractProductList.map((x) => {
  2557. // if (fileObj[x.productId] && fileObj[x.productId].length > 0) {
  2558. // x.fileUrl = fileObj[x.productId][0].fileUrl;
  2559. // }
  2560. x.contractProductBomList.map((y) => {
  2561. y.fileList = fileObj[y.materialId] || [];
  2562. if (y.fileList && y.fileList.length > 0) {
  2563. y.fileUrl = y.fileList[0].fileUrl;
  2564. }
  2565. });
  2566. });
  2567. });
  2568. };
  2569. const getPriceSheetData = (id) => {
  2570. proxy.post("/extQuotation/toContractDetail", { id }).then(async (res) => {
  2571. if (formData.data.deptId) {
  2572. res.deptId = formData.data.deptId;
  2573. }
  2574. formData.data = res;
  2575. formData.data = {
  2576. contractType: route.query.contractType,
  2577. salesmanId: proxy.useUserStore().user.userId,
  2578. templateContent: "",
  2579. quotationId: res.id,
  2580. // companyId: res.companyId,
  2581. ofCompanyId: res.ofCompanyId,
  2582. deptId: res.deptId,
  2583. qualityLv: res.qualityLv,
  2584. buyCorporationId: res.buyCorporationId,
  2585. buyAddress: res.buyAddress,
  2586. buyPostalCode: res.buyPostalCode,
  2587. buyContactName: res.buyContactName,
  2588. buyContactNumber: res.buyContactNumber,
  2589. amount: res.amount,
  2590. };
  2591. changeCustomer(res.buyCorporationId);
  2592. // if (res.type == 1) {
  2593. // formData.data.contractType = "2";
  2594. // if (currencyData.value && currencyData.value.length > 0) {
  2595. // formData.data.currency = currencyData.value[0].dictKey;
  2596. // }
  2597. // formData.data.rate = 1;
  2598. // } else {
  2599. // formData.data.contractType = "1";
  2600. // }
  2601. let bomIds = [];
  2602. formData.data.contractProductList = res.quotationProductList.map((x) => ({
  2603. quotationProductId: x.id,
  2604. fileUrl: "",
  2605. productId: x.productId,
  2606. productClassifyName: x.productClassifyName,
  2607. productName: x.productName,
  2608. productCode: x.productCode,
  2609. productColor: x.productColor,
  2610. productFrontalTexture: x.productFrontalTexture,
  2611. productNetWeight: x.productNetWeight,
  2612. productUnit: x.productUnit,
  2613. productLength: x.productLength,
  2614. productWidth: x.productWidth,
  2615. productHeight: x.productHeight,
  2616. prodFilePath: x.productProdImgPath,
  2617. quantity: x.quantity,
  2618. price: x.price,
  2619. amount: x.amount,
  2620. businessCostPrice: x.businessCostPrice,
  2621. factoryPrice: x.prodPrice,
  2622. amountTwo: Number(
  2623. parseFloat(x.quantity * x.businessCostPrice).toFixed(2)
  2624. ),
  2625. fileList: [],
  2626. contractProductBomList: x.quotationProductBomList.map((y) => {
  2627. bomIds.push(y.id);
  2628. y.bomFileList = [];
  2629. y.quotationProductBomId = y.id;
  2630. delete y.id;
  2631. return y;
  2632. }),
  2633. rowId: uuidv4(),
  2634. }));
  2635. // 获取BOM文件
  2636. proxy.getFileData({ businessIdList: bomIds, getAll: true }).then((res) => {
  2637. for (let i = 0; i < formData.data.contractProductList.length; i++) {
  2638. const iele = formData.data.contractProductList[i];
  2639. for (let j = 0; j < iele.contractProductBomList.length; j++) {
  2640. const jele = iele.contractProductBomList[j];
  2641. let fileData = res[jele.quotationProductBomId] || [];
  2642. if (fileData && fileData.length > 0) {
  2643. jele.bomFileList = fileData
  2644. .filter((x) => x.businessType == "10")
  2645. .map((y) => ({ ...y, name: y.fileName, url: y.fileUrl }));
  2646. } else {
  2647. jele.bomFileList = [];
  2648. }
  2649. }
  2650. }
  2651. });
  2652. changeProductPrice();
  2653. totalAmount();
  2654. getFileData();
  2655. let productIds = formData.data.contractProductList.map((x) => x.productId);
  2656. const productAllFile = await proxy.getFileData({
  2657. businessIdList: productIds,
  2658. getAll: true,
  2659. });
  2660. for (let i = 0; i < formData.data.contractProductList.length; i++) {
  2661. const ele = formData.data.contractProductList[i];
  2662. for (const key in productAllFile) {
  2663. if (
  2664. ele.productId == key &&
  2665. productAllFile[ele.productId] &&
  2666. productAllFile[ele.productId].length > 0
  2667. ) {
  2668. ele.productFile = productAllFile[ele.productId].filter(
  2669. (x) => x.businessType == "0"
  2670. );
  2671. if (ele.productFile && ele.productFile.length > 0) {
  2672. ele.fileUrl = ele.productFile[0].fileUrl;
  2673. }
  2674. ele.fileListOne = productAllFile[ele.productId].filter(
  2675. (x) => x.businessType == "2"
  2676. );
  2677. if (ele.fileListOne && ele.fileListOne.length > 0) {
  2678. ele.isShowProductFile = true;
  2679. } else {
  2680. ele.isShowProductFile = false;
  2681. }
  2682. break;
  2683. }
  2684. }
  2685. }
  2686. formData.data.countryId = res.buyCountryId;
  2687. formData.data.provinceId = res.buyProvinceId;
  2688. formData.data.cityId = res.buyCityId;
  2689. if (formData.data.countryId) {
  2690. getCityData(formData.data.countryId, "20");
  2691. }
  2692. if (formData.data.provinceId) {
  2693. getCityData(formData.data.provinceId, "30");
  2694. }
  2695. });
  2696. };
  2697. // 是否能编辑修改产品列表
  2698. const isEditList = ref(true);
  2699. onMounted(() => {
  2700. formData.data.ofCompanyId = proxy.useUserStore().user.companyId;
  2701. formData.data.salesmanId = proxy.useUserStore().user.userId;
  2702. handleOfCompanyIdChange(formData.data.ofCompanyId);
  2703. if (
  2704. proxy.useUserStore().currentCompany == proxy.useUserStore().user.ofCompanyId
  2705. ) {
  2706. formData.data.deptId = proxy.useUserStore().user.deptId;
  2707. }
  2708. if (currencyData.value && currencyData.value.length > 0) {
  2709. formData.data.currency = currencyData.value[0].dictKey;
  2710. }
  2711. formOption.disabled = judgeStatus();
  2712. // 报价转销售订单
  2713. if (route.query && route.query.priceSheetId) {
  2714. getPriceSheetData(route.query.priceSheetId);
  2715. isEditList.value = false;
  2716. } else if (route.query && route.query.businessId && route.query.processType) {
  2717. let businessId = route.query.businessId;
  2718. getAllData(businessId);
  2719. } else if (
  2720. route.query &&
  2721. route.query.businessId &&
  2722. !route.query.processType
  2723. ) {
  2724. let businessId = route.query.businessId;
  2725. getAllData(businessId);
  2726. }
  2727. });
  2728. watch(
  2729. () => props.queryData,
  2730. (val) => {
  2731. nextTick(() => {
  2732. formOption.disabled = judgeStatus();
  2733. });
  2734. if (val.businessId && val.processType) {
  2735. getAllData(val.businessId);
  2736. }
  2737. },
  2738. {
  2739. deep: true,
  2740. immediate: true,
  2741. }
  2742. );
  2743. const showPriceInfo = () => {
  2744. if (props.queryData.processType) {
  2745. return false;
  2746. }
  2747. if (route.query.processType) {
  2748. return false;
  2749. } else {
  2750. return true;
  2751. }
  2752. };
  2753. const optionTwo = reactive({
  2754. data: {
  2755. tooltip: {
  2756. trigger: "axis",
  2757. },
  2758. // legend: {
  2759. // data: ["价格"],
  2760. // },
  2761. grid: {
  2762. left: "3%",
  2763. right: "4%",
  2764. top: "10%",
  2765. bottom: "3%",
  2766. containLabel: true,
  2767. },
  2768. // toolbox: {
  2769. // feature: {
  2770. // saveAsImage: {},
  2771. // },
  2772. // },
  2773. xAxis: {
  2774. type: "category",
  2775. boundaryGap: false,
  2776. data: [],
  2777. },
  2778. yAxis: {
  2779. type: "value",
  2780. },
  2781. series: [
  2782. {
  2783. name: "价格",
  2784. type: "line",
  2785. data: [],
  2786. },
  2787. ],
  2788. },
  2789. });
  2790. const showEcharts = (row, index) => {
  2791. let myChart = null;
  2792. myChart = echarts.init(proxy.$refs[row.productId + index]);
  2793. window.addEventListener("resize", () => {
  2794. myChart.resize();
  2795. });
  2796. if (row.contractProductListOne && row.contractProductListOne.length > 0) {
  2797. optionTwo.data.xAxis.data = row.contractProductListOne.map((item) => {
  2798. return item.createTime.slice(0, 10);
  2799. });
  2800. optionTwo.data.series[0].data = row.contractProductListOne.map((item) => {
  2801. return item.price;
  2802. });
  2803. } else {
  2804. optionTwo.data.xAxis.data = [];
  2805. optionTwo.data.series[0].data = [];
  2806. }
  2807. myChart.setOption(optionTwo.data);
  2808. myChart.resize();
  2809. };
  2810. const clickCopy = (type) => {
  2811. copyType.value = type;
  2812. copyContract.value = true;
  2813. };
  2814. </script>
  2815. <style lang="scss" scoped>
  2816. .img {
  2817. object-fit: contain;
  2818. width: 16px;
  2819. height: 16px;
  2820. vertical-align: middle;
  2821. }
  2822. .pic {
  2823. object-fit: contain;
  2824. width: 50px;
  2825. height: 50px;
  2826. cursor: pointer;
  2827. vertical-align: middle;
  2828. }
  2829. .el-icon.avatar-uploader-icon {
  2830. font-size: 20px;
  2831. color: #8c939d;
  2832. width: 50px;
  2833. height: 50px;
  2834. text-align: center;
  2835. border: 1px dashed var(--el-border-color);
  2836. }
  2837. .ql-editor {
  2838. padding: 0px;
  2839. }
  2840. :deep(.el-upload-list) {
  2841. margin: 0px !important;
  2842. position: relative;
  2843. top: -8px;
  2844. left: -8px;
  2845. }
  2846. :deep(.el-upload-list--text .el-upload-list__item) {
  2847. min-width: 150px !important;
  2848. }
  2849. :deep(.bom-table .el-table__body-wrapper .el-table__body .el-table__row) {
  2850. background: #f4f4f5 !important;
  2851. }
  2852. </style>