edit.vue 78 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371
  1. <template>
  2. <div>
  3. <div
  4. v-if="loading"
  5. v-loading="true"
  6. class="view-window"
  7. element-loading-text="Loading..."
  8. element-loading-background="rgba(0, 0, 0, 0.3)"
  9. ></div>
  10. <div class="flex fixed-button-area">
  11. <!-- <el-button @click="() => generatePDF()">generatePDF</el-button> -->
  12. <el-button
  13. type="info"
  14. @click="formVisible = !formVisible"
  15. >
  16. <el-icon
  17. size="18px"
  18. color="#fff"
  19. >
  20. <Switch />
  21. </el-icon>
  22. &nbsp;{{ formVisible ? 'Preview PDF' : 'Show Form' }}
  23. </el-button>
  24. <el-button
  25. type="primary"
  26. :disabled="!formVisible"
  27. @click="checkForm(mainForm)"
  28. >
  29. <el-icon
  30. size="20px"
  31. color="#fff"
  32. >
  33. <FolderAdd />
  34. </el-icon>
  35. &nbsp;Save & Attach
  36. </el-button>
  37. </div>
  38. <div
  39. v-show="formVisible"
  40. class="screen"
  41. >
  42. <div class="flex justify-between page-title-wrap">
  43. <div class="flex">
  44. <el-icon
  45. size="36px"
  46. :color="variables.mainColor"
  47. >
  48. <ShoppingCart />
  49. </el-icon>
  50. <div class="page-title">New Purchase Order</div>
  51. </div>
  52. </div>
  53. <el-form
  54. ref="mainForm"
  55. :model="form"
  56. :rules="formRule"
  57. label-width="120px"
  58. >
  59. <div class="flex items-start">
  60. <div class="layout-left">
  61. <el-form-item
  62. prop="Order_Type"
  63. label="Order Type"
  64. label-width="130px"
  65. >
  66. <el-radio-group v-model="form.Order_Type">
  67. <el-radio
  68. v-for="(item, index) in orderTypeList"
  69. :key="index"
  70. :label="item.label"
  71. :value="item.label"
  72. >
  73. {{ item.label }}
  74. </el-radio>
  75. </el-radio-group>
  76. </el-form-item>
  77. <el-form-item
  78. label="Artwork Link"
  79. prop="Artwork_Link"
  80. label-width="130px"
  81. >
  82. <el-input
  83. v-model="form.Artwork_Link"
  84. placeholder="Please input"
  85. type="textarea"
  86. :rows="3"
  87. ></el-input>
  88. </el-form-item>
  89. <el-form-item
  90. label="Currency"
  91. label-width="130px"
  92. >
  93. <el-select
  94. v-model="form.Currency"
  95. style="width: 100%"
  96. placeholder="please select currency"
  97. >
  98. <el-option
  99. v-for="(item, index) in currencyList"
  100. :key="index"
  101. :label="item.label"
  102. :value="item.label"
  103. />
  104. </el-select>
  105. </el-form-item>
  106. <el-form-item
  107. v-if="recommandVendor.length"
  108. label="Frequently Used Supplier"
  109. label-position="right"
  110. label-width="180px"
  111. >
  112. <div class="flex flex-col items-start">
  113. <!-- <div class="text-gray-400">最近10个PO的供应商列表</div> -->
  114. <div
  115. v-for="(item, index) in recommandVendor"
  116. :key="index"
  117. class="btn-quick-vendor"
  118. :class="{ active: item.id === form.currentVendor }"
  119. @click="quickSelectSupplier(item)"
  120. >
  121. {{ item.name || '' }}
  122. </div>
  123. </div>
  124. </el-form-item>
  125. <div
  126. v-show="preferSupplier.length"
  127. class="pl-[12px]"
  128. >
  129. <div class="text-gray-400">
  130. <span>Product Team Preferred Supplier</span>
  131. <!-- <span class="text-sm">&nbsp;(单击供应商名称快速选中)</span> -->
  132. </div>
  133. <div
  134. v-for="(item, index) in preferSupplier"
  135. :key="item.sku"
  136. class="flex text-sm"
  137. :class="{
  138. 'border border-gray-200 border-x-[0] border-t-[0] border-solid':
  139. index + 1 === preferSupplier.length,
  140. }"
  141. >
  142. <div
  143. class="border border-solid border-gray-200 border-r-[0] border-b-[0] min-w-[100px] flex justify-center items-center"
  144. >
  145. {{ item.sku }}
  146. </div>
  147. <div class="flex-auto flex flex-col">
  148. <div
  149. v-for="subItem in item.list"
  150. :key="subItem.id"
  151. :style="{
  152. backgroundColor:
  153. subItem.Supplier.id === form.currentVendor
  154. ? '#409eff'
  155. : '#fff',
  156. color:
  157. subItem.Supplier.id === form.currentVendor
  158. ? '#fff'
  159. : '#333',
  160. }"
  161. class="border border-solid border-gray-200 border-b-[0] p-[6px] hover:bg-sky-100"
  162. >
  163. <el-tooltip
  164. placement="right"
  165. :content="subItem.Note"
  166. :disabled="!subItem.Note"
  167. >
  168. <span
  169. class="cursor-pointer"
  170. @click="quickSelectSupplier(subItem.Supplier)"
  171. >
  172. <span>
  173. {{ subItem.Supplier.name }}
  174. </span>
  175. <span v-if="subItem.Priority">
  176. &nbsp;-&nbsp;{{ subItem.Priority }}
  177. </span>
  178. </span>
  179. </el-tooltip>
  180. </div>
  181. </div>
  182. </div>
  183. </div>
  184. </div>
  185. <div class="layout-right flex-auto">
  186. <div style="position: absolute; right: 24px; top: 0">
  187. <el-form-item label="Template:">
  188. <el-select
  189. v-model="currentCompany"
  190. style="width: 150px"
  191. @change="onCompanyTemplateChange"
  192. >
  193. <el-option
  194. v-for="company in computedCompanyList"
  195. :key="company.id"
  196. :value="company.id"
  197. :label="company.label"
  198. ></el-option>
  199. </el-select>
  200. </el-form-item>
  201. </div>
  202. <div class="company-info">
  203. <div class="company-name">{{ computedCompany.name }}</div>
  204. <div class="flex justify-center">
  205. <div class="company-addr">
  206. 地址:&nbsp;{{ computedCompany.addr }}
  207. </div>
  208. <div class="company-phone">
  209. &nbsp;|&nbsp;电话:&nbsp;{{ computedCompany.phone }}
  210. </div>
  211. <div
  212. v-show="computedCompany.fax"
  213. class="company-fax"
  214. >
  215. &nbsp;|&nbsp;传真:&nbsp;{{ computedCompany.fax }}
  216. </div>
  217. </div>
  218. </div>
  219. <div class="pdf-title">采购合同</div>
  220. <div class="pdf-title-bg">
  221. <div class="left"></div>
  222. <div class="right"></div>
  223. </div>
  224. <div class="flex items-start justify-between form-area">
  225. <div class="form-area-left">
  226. <div class="">
  227. <span style="color: #f56c6c">*</span>
  228. 供应商(乙方) :
  229. </div>
  230. <div>{{ computedVendor.Primary_Contact_name }}</div>
  231. <el-form-item
  232. label-width="0"
  233. prop="currentVendor"
  234. >
  235. <el-select
  236. v-model="form.currentVendor"
  237. :remote-method="utils.debounce(getSupplierLists, 1000)"
  238. remote
  239. style="width: 100%"
  240. :loading="vendorLoading"
  241. filterable
  242. clearable
  243. >
  244. <el-option
  245. v-for="option in vendorList"
  246. :key="option.value"
  247. :value="option.value"
  248. :label="option.label"
  249. ></el-option>
  250. </el-select>
  251. </el-form-item>
  252. <div
  253. v-if="typeof computedCompany.taxReimbursement === 'undefined'"
  254. style="white-space: pre-wrap"
  255. >
  256. {{ computedVendor.PDF_display }}
  257. </div>
  258. <div
  259. v-else
  260. style="white-space: pre-wrap"
  261. >
  262. {{ computedVendor.PDF_display2 }}
  263. </div>
  264. </div>
  265. <div class="form-area-right">
  266. <el-form-item label="采购订单 #:">
  267. Generate once PO submitted
  268. </el-form-item>
  269. <el-form-item label="订单号 # :">
  270. <el-input
  271. v-model="form.Reference"
  272. disabled
  273. ></el-input>
  274. </el-form-item>
  275. <el-form-item
  276. label="日期:"
  277. prop="PO_Date"
  278. >
  279. <el-date-picker
  280. v-model="form.PO_Date"
  281. format="YYYY-MM-DD"
  282. value-format="YYYY-MM-DD"
  283. style="width: 100%"
  284. type="date"
  285. ></el-date-picker>
  286. </el-form-item>
  287. <el-form-item label="付款方式 :">
  288. <el-select
  289. v-model="form.Supplier_Payment_Terms"
  290. style="width: 100%"
  291. >
  292. <el-option
  293. v-for="(item, index) in supplierPaymentTermsLists"
  294. :key="index"
  295. :value="item.label"
  296. :label="item.label"
  297. ></el-option>
  298. </el-select>
  299. </el-form-item>
  300. <el-form-item label="参考 :">
  301. <el-input v-model="form.Title"></el-input>
  302. </el-form-item>
  303. <!-- 退税版没有这几项 -->
  304. <template
  305. v-if="typeof computedCompany.taxReimbursement === 'undefined'"
  306. >
  307. <el-form-item label="收货详情 :">
  308. <el-select
  309. v-model="form.field9"
  310. style="width: 100%"
  311. >
  312. <el-option
  313. v-for="(item, index) in addressList"
  314. :key="index"
  315. :value="item.label"
  316. :label="item.label"
  317. ></el-option>
  318. </el-select>
  319. </el-form-item>
  320. <el-form-item
  321. label="收件人 :"
  322. prop="field7"
  323. >
  324. <el-input v-model="form.field7"></el-input>
  325. </el-form-item>
  326. <el-form-item
  327. label="联系电话 :"
  328. prop="field8"
  329. >
  330. <el-input v-model="form.field8"></el-input>
  331. </el-form-item>
  332. </template>
  333. <el-form-item
  334. label="工厂交货日期 :"
  335. prop="field6"
  336. >
  337. <el-date-picker
  338. v-model="form.field6"
  339. style="width: 100%"
  340. format="YYYY-MM-DD"
  341. value-format="YYYY-MM-DD"
  342. ></el-date-picker>
  343. </el-form-item>
  344. <el-form-item label="送货备注 :">
  345. <el-input v-model="form.Delivery_Details"></el-input>
  346. </el-form-item>
  347. </div>
  348. </div>
  349. <div class="product-table-separator"></div>
  350. <div class="product-table">
  351. <table
  352. border="0"
  353. cellspacing="0"
  354. >
  355. <tr>
  356. <th class="product">品名</th>
  357. <th class="quantity">数量</th>
  358. <th class="rate">价格&nbsp;({{ currentCurrency.label }})</th>
  359. <th class="requirement">中文品目|要求</th>
  360. <th class="amount">金额</th>
  361. <th class="discount">折扣</th>
  362. <th class="warehouse">Warehouse</th>
  363. <th class="action">操作</th>
  364. </tr>
  365. <tr
  366. v-for="(product, index) in form.productList"
  367. :key="index"
  368. >
  369. <td class="product">
  370. <el-form-item
  371. label-width="0"
  372. :prop="'productList.' + index + '.id'"
  373. :rules="{
  374. required: true,
  375. message: '必填项',
  376. trigger: ['blur', 'change'],
  377. }"
  378. >
  379. <el-select-v2
  380. v-model="product.id"
  381. popper-class="product-select"
  382. style="width: 100%; margin-bottom: 4pt"
  383. :options="product.candidate"
  384. :loading="productLoading"
  385. :remote-method="
  386. (e: string) => getProductList(e, product)
  387. "
  388. remote
  389. filterable
  390. clearable
  391. @change="(e) => onProductSelect(e, product)"
  392. ></el-select-v2>
  393. </el-form-item>
  394. <el-input
  395. v-if="userInfo.Organization !== 'PrimePac'"
  396. v-model="product.desc"
  397. type="textarea"
  398. placeholder="Free text"
  399. ></el-input>
  400. </td>
  401. <td class="quantity">
  402. <el-form-item
  403. label-width="0"
  404. :prop="'productList.' + index + '.quantity'"
  405. :rules="{
  406. required: true,
  407. message: '必填项',
  408. trigger: ['blur', 'change'],
  409. }"
  410. >
  411. <el-input
  412. v-model="product.quantity"
  413. type="number"
  414. min="1"
  415. @change="(e) => onInputChange(e, product, 'quantity')"
  416. ></el-input>
  417. </el-form-item>
  418. </td>
  419. <td class="rate">
  420. <el-form-item
  421. label-width="0"
  422. :prop="'productList.' + index + '.rate'"
  423. :rules="{
  424. required: true,
  425. message: '必填项',
  426. trigger: ['blur', 'change'],
  427. }"
  428. >
  429. <el-input
  430. v-model="product.rate"
  431. type="number"
  432. @change="(e) => onInputChange(e, product, 'rate')"
  433. ></el-input>
  434. </el-form-item>
  435. </td>
  436. <td class="requirement">
  437. <el-input
  438. v-model="product.requirement"
  439. :rows="userInfo.Organization !== 'PrimePac' ? 4 : 5"
  440. type="textarea"
  441. placeholder="Free text"
  442. ></el-input>
  443. </td>
  444. <td class="amount">
  445. <el-input
  446. v-model="product.amount"
  447. type="number"
  448. disabled
  449. ></el-input>
  450. </td>
  451. <td class="discount">
  452. <el-input
  453. v-model="product.discount"
  454. type="number"
  455. @change="(e) => onInputChange(e, product, 'discount')"
  456. ></el-input>
  457. </td>
  458. <td class="">
  459. <el-form-item
  460. label-width="0"
  461. :prop="'productList.' + index + '.Warehouse'"
  462. :rules="{
  463. required: product.CF_Product_Type === 'Stock',
  464. message: '必填项',
  465. trigger: ['blur', 'change'],
  466. }"
  467. >
  468. <el-select
  469. v-model="product.Warehouse"
  470. clearable
  471. >
  472. <el-option
  473. v-for="v in warehouseList"
  474. :key="v"
  475. :label="v"
  476. :value="v"
  477. ></el-option>
  478. </el-select>
  479. </el-form-item>
  480. </td>
  481. <td class="action">
  482. <el-button
  483. size="small"
  484. type="danger"
  485. plain
  486. @click="form.productList.splice(index, 1)"
  487. >
  488. Delete
  489. </el-button>
  490. </td>
  491. </tr>
  492. </table>
  493. </div>
  494. <div>
  495. <el-button
  496. type="primary"
  497. size="small"
  498. plain
  499. @click="addRow"
  500. >
  501. Add Row
  502. </el-button>
  503. </div>
  504. <div class="flex justify-end">
  505. <div class="product-total-table">
  506. <div class="total-item">
  507. <div class="label">Sub Total</div>
  508. <div class="value">{{ toFixed(subTotal, 2) }}</div>
  509. </div>
  510. <div class="total-item">
  511. <div class="label">Total Discount</div>
  512. <div class="value">
  513. {{ toFixed(totalDiscount, 2) }}
  514. </div>
  515. </div>
  516. <div class="total-item">
  517. <div class="label">Adjustment</div>
  518. <div class="value">
  519. <el-input
  520. v-model="adjustment"
  521. style="width: 100%"
  522. type="number"
  523. ></el-input>
  524. </div>
  525. </div>
  526. <div class="total-item">
  527. <div class="label">Grand Total</div>
  528. <div class="value">
  529. {{ toFixed(grandTotal, 2) }}
  530. </div>
  531. </div>
  532. </div>
  533. </div>
  534. <div
  535. v-if="userInfo.Organization !== 'PrimePac'"
  536. class="note-form-area"
  537. >
  538. <div class="sub-form-title">注意事项:</div>
  539. <el-form-item label="印刷质量:">
  540. <el-input
  541. v-model="form.field12"
  542. type="textarea"
  543. :rows="3"
  544. ></el-input>
  545. </el-form-item>
  546. <el-form-item label="产品质量:">
  547. <el-input
  548. v-model="form.field13"
  549. type="textarea"
  550. :rows="3"
  551. ></el-input>
  552. </el-form-item>
  553. <el-form-item label="质量承诺:">
  554. <el-input
  555. v-model="form.field10"
  556. type="textarea"
  557. :rows="3"
  558. ></el-input>
  559. </el-form-item>
  560. <el-form-item label="箱子箱唛:">
  561. <el-input
  562. v-model="form.field11"
  563. type="textarea"
  564. :rows="3"
  565. ></el-input>
  566. </el-form-item>
  567. </div>
  568. <div class="sub-form-title">服务条款</div>
  569. <template v-if="currentCompany === 'PangeaTaxReimbursement'">
  570. <div class="rule-item flex">
  571. 一、合同价为含税价,税率为:
  572. <span style="color: #f56c6c">*</span>
  573. <el-form-item
  574. label-width="10"
  575. prop="field4"
  576. :rules="{
  577. required: true,
  578. message: '必填项',
  579. trigger: ['blur', 'change'],
  580. }"
  581. >
  582. <el-input
  583. v-model="form.field4"
  584. size="small"
  585. style="width: 120px"
  586. >
  587. <template #append>%</template>
  588. </el-input>
  589. </el-form-item>
  590. </div>
  591. <div class="rule-item flex">
  592. 二、运费条款:
  593. <span style="color: #f56c6c">*</span>
  594. <el-form-item label-width="10">
  595. <el-select
  596. v-model="form.field5"
  597. size="small"
  598. style="width: 110px"
  599. >
  600. <el-option
  601. v-for="(item, index) in field5_lists"
  602. :key="index"
  603. :label="item.label"
  604. :value="item.label"
  605. ></el-option>
  606. </el-select>
  607. </el-form-item>
  608. </div>
  609. </template>
  610. <template
  611. v-if="['PrimePacCommon', 'PrimePacSoft'].includes(currentCompany)"
  612. >
  613. <div class="rule-item">
  614. 一、本采购订单签署原件一式两份,双方各持一份。经双方代表签字或盖章即可生效,并具有同等法律效力。
  615. </div>
  616. <div class="rule-item flex nowrap">
  617. 二、以上价格已含所有产品的制作费、包装费;由
  618. <div class="attention flex nowrap">
  619. <span style="color: #f56c6c">*</span>
  620. <el-form-item label-width="10">
  621. <el-select
  622. v-model="form.field5"
  623. size="small"
  624. style="width: 110px"
  625. >
  626. <el-option
  627. v-for="(item, index) in field5_lists"
  628. :key="index"
  629. :label="item.label"
  630. :value="item.label"
  631. ></el-option>
  632. </el-select>
  633. </el-form-item>
  634. </div>
  635. 运费送货到广州甲方指定的卸货地点,不含税,运费届时实报实销。
  636. </div>
  637. <div class="rule-item">
  638. 三、印刷及工艺要求:乙方需按照甲方图稿或指定样品进行生产,颜色对照潘通色卡或指定样品。
  639. </div>
  640. <div class="rule-item">
  641. 四、付款形式:
  642. <span class="attention">{{ form.Supplier_Payment_Terms }}</span>
  643. 。甲方在乙方完成大货时,先寄大货样品给乙方确认,确认后付清剩余尾款。甲方通过银行转帐的方式付款,乙方账户信息如上。
  644. </div>
  645. <div class="rule-item">
  646. 五、出货标准:五层出口空白硬纸箱,箱内套防潮袋。如实际出货包装与合约要求不符,甲方有权拒收整批货物。
  647. </div>
  648. <div class="rule-item">
  649. 六、订货时间:自合同成立,甲方支付定金并确认图稿后算起。
  650. </div>
  651. <div class="rule-item">
  652. 七、交货期限:自确认图稿时间算起,乙方应于
  653. <span class="attention">{{ form.field6 }}</span>
  654. 前生产好产品,甲方确认并支付剩余款项后,乙方在约定时间内安排发出剩余产品到甲方收货地址。
  655. </div>
  656. </template>
  657. <div
  658. v-for="(item, index) in currentServiceRule"
  659. :key="index"
  660. class="rule-item"
  661. :class="[{ sub: typeof item === 'object' }]"
  662. v-html="typeof item === 'object' ? item.value : item"
  663. ></div>
  664. <template
  665. v-if="['PrimePacCommon', 'PrimePacSoft'].includes(currentCompany)"
  666. >
  667. <div class="sub-form-title">附录</div>
  668. <div
  669. v-for="(item, index) in appendixData"
  670. :key="index"
  671. class="rule-item"
  672. :class="[{ sub: typeof item === 'object' }]"
  673. v-html="typeof item === 'object' ? item.value : item"
  674. ></div>
  675. </template>
  676. <div
  677. v-if="currentCompany === 'PrimePacCommon'"
  678. class="flex items-stretch PrimePac-table"
  679. >
  680. <div class="flex flex-col items-stretch">
  681. <div class="column-item flex justify-center">制作要求</div>
  682. <div class="flex-auto column-item flex justify-center">
  683. 产品外观要求
  684. </div>
  685. </div>
  686. <div class="flex-auto flex flex-col items-stretch">
  687. <div
  688. v-for="(item, index) in PrimePacCommonRuleTableData"
  689. :key="index"
  690. class="flex items-stretch flex-auto"
  691. >
  692. <div class="column-item flex justify-center">
  693. {{ item.project }}
  694. </div>
  695. <div class="column-item flex-auto flex justify-center">
  696. {{ item.method }}
  697. </div>
  698. </div>
  699. </div>
  700. </div>
  701. <div
  702. v-if="currentCompany === 'PrimePacSoft'"
  703. class="flex flex-col items-stretch PrimePac-table"
  704. >
  705. <div class="flex items-stretch">
  706. <div class="flex flex-col items-stretch">
  707. <div class="column-item flex-auto flex justify-center">
  708. 制作要求
  709. </div>
  710. </div>
  711. <div class="flex-auto flex flex-col items-stretch">
  712. <div
  713. v-for="(item, index) in PrimePacSoftRuleTableData1"
  714. :key="index"
  715. class="flex items-stretch flex-auto"
  716. >
  717. <div class="column-item flex justify-center">
  718. {{ item.project }}
  719. </div>
  720. <div class="column-item flex-auto flex justify-center">
  721. {{ item.method }}
  722. </div>
  723. </div>
  724. </div>
  725. </div>
  726. <div class="flex items-stretch">
  727. <div class="flex flex-col items-stretch">
  728. <div class="column-item flex-auto flex justify-center">
  729. 产品技术要求
  730. </div>
  731. </div>
  732. <div class="flex-auto flex flex-col items-stretch">
  733. <div
  734. v-for="(item, index) in PrimePacSoftRuleTableData2"
  735. :key="index"
  736. class="flex items-stretch flex-auto"
  737. >
  738. <div class="column-item flex justify-center">
  739. {{ item.project }}
  740. </div>
  741. <div class="column-item flex-auto flex justify-center">
  742. {{ item.method }}
  743. </div>
  744. </div>
  745. </div>
  746. </div>
  747. </div>
  748. </div>
  749. </div>
  750. </el-form>
  751. <br />
  752. </div>
  753. <div
  754. class="print"
  755. :class="{ hidden: formVisible && !loading }"
  756. >
  757. <div class="pdf-wrap">
  758. <div
  759. id="pdfElement"
  760. ref="pdfElement"
  761. class="preview-area"
  762. >
  763. <div class="company-info">
  764. <div class="company-name">{{ computedCompany.name }}</div>
  765. <div class="flex justify-center">
  766. <div class="company-addr">
  767. 地址:&nbsp;{{ computedCompany.addr }}
  768. </div>
  769. <div class="company-phone">
  770. &nbsp;|&nbsp;电话:&nbsp;{{ computedCompany.phone }}
  771. </div>
  772. <div
  773. v-show="computedCompany.fax"
  774. class="company-fax"
  775. >
  776. &nbsp;|&nbsp;传真:&nbsp;{{ computedCompany.fax }}
  777. </div>
  778. </div>
  779. </div>
  780. <div>
  781. <table class="pdf-title-bg">
  782. <tr>
  783. <td class="left">
  784. <div>&nbsp;</div>
  785. </td>
  786. <td class="center">
  787. <div class="pdf-title">采购合同</div>
  788. </td>
  789. <td class="right">
  790. <div>&nbsp;</div>
  791. </td>
  792. </tr>
  793. </table>
  794. </div>
  795. <div class="form-area flex items-start">
  796. <div class="flex-auto">
  797. <div>供应商(乙方) :</div>
  798. <div
  799. v-if="computedVendor.Primary_Contact_name"
  800. class="column-vendor"
  801. >
  802. {{ computedVendor.Primary_Contact_name }}
  803. </div>
  804. <div class="column-vendor">
  805. {{ computedVendor.label }}
  806. </div>
  807. <div
  808. v-if="typeof computedCompany.taxReimbursement === 'undefined'"
  809. class="column-vendor"
  810. >
  811. {{ computedVendor.PDF_display }}
  812. </div>
  813. <div
  814. v-else
  815. class="column-vendor"
  816. >
  817. {{ computedVendor.PDF_display2 }}
  818. </div>
  819. </div>
  820. <div class="flex-auto">
  821. <div class="flex">
  822. <div class="column-form-label">采购订单 #:</div>
  823. <div class="column-form-value">
  824. {{ longPONumber || '' }}
  825. </div>
  826. </div>
  827. <div class="flex">
  828. <div class="column-form-label">订单号 # :</div>
  829. <div class="column-form-value">
  830. {{ form.Reference }}
  831. </div>
  832. </div>
  833. <div class="flex">
  834. <div class="column-form-label">日期 :</div>
  835. <div class="column-form-value">
  836. {{ form.PO_Date }}
  837. </div>
  838. </div>
  839. <div class="flex">
  840. <div class="column-form-label">付款方式 :</div>
  841. <div class="column-form-value">
  842. {{
  843. form.Supplier_Payment_Terms !== '-None-'
  844. ? form.Supplier_Payment_Terms
  845. : ''
  846. }}
  847. </div>
  848. </div>
  849. <div class="flex items-start">
  850. <div class="column-form-label">参考 :</div>
  851. <div class="column-form-value">
  852. {{ form.Title }}
  853. </div>
  854. </div>
  855. <template
  856. v-if="typeof computedCompany.taxReimbursement === 'undefined'"
  857. >
  858. <div class="flex items-start">
  859. <div class="column-form-label">收货详情 :</div>
  860. <div class="column-form-value">
  861. {{ form.field9 }}
  862. </div>
  863. </div>
  864. <div class="flex">
  865. <div class="column-form-label">收件人 :</div>
  866. <div class="column-form-value">
  867. {{ form.field7 }}
  868. </div>
  869. </div>
  870. <div class="flex">
  871. <div class="column-form-label">联系电话 :</div>
  872. <div class="column-form-value">
  873. {{ form.field8 }}
  874. </div>
  875. </div>
  876. </template>
  877. <div class="flex">
  878. <div class="column-form-label">工厂交货日期 :</div>
  879. <div class="column-form-value">
  880. {{ form.field6 }}
  881. </div>
  882. </div>
  883. <div class="flex">
  884. <div class="column-form-label">送货备注 :</div>
  885. <div class="column-form-value">
  886. {{ form.Delivery_Details }}
  887. </div>
  888. </div>
  889. </div>
  890. </div>
  891. <div class="product-table-separator"></div>
  892. <div class="product-table">
  893. <table
  894. border="0"
  895. cellspacing="0"
  896. >
  897. <tr>
  898. <th class="row-index">#</th>
  899. <th>品名</th>
  900. <th v-if="userInfo.Organization !== 'PrimePac'">
  901. 中文品目|要求
  902. </th>
  903. <th>数量</th>
  904. <th>价格&nbsp;({{ currentCurrency.label }})</th>
  905. <th>金额</th>
  906. </tr>
  907. <tr
  908. v-for="(product, index) in form.productList"
  909. :key="index"
  910. >
  911. <td class="row-index">{{ index + 1 }}.</td>
  912. <td>
  913. <div class="product-name">{{ product.name }}</div>
  914. <div
  915. v-if="userInfo.Organization !== 'PrimePac'"
  916. class="desc"
  917. >
  918. {{ product.desc }}
  919. </div>
  920. <div
  921. v-else
  922. class="desc"
  923. >
  924. {{ product.requirement }}
  925. </div>
  926. </td>
  927. <td v-if="userInfo.Organization !== 'PrimePac'">
  928. {{ product.requirement }}
  929. </td>
  930. <td>
  931. {{ product.quantity }}
  932. </td>
  933. <td>
  934. {{ currentCurrency.country
  935. }}{{ currentCurrency.symbol }}&nbsp;{{
  936. toFixed(Number(product.rate), computedDeci)
  937. }}
  938. </td>
  939. <td>
  940. {{ currentCurrency.country
  941. }}{{ currentCurrency.symbol }}&nbsp;{{
  942. toFixed(Number(product.amount), computedDeci)
  943. }}
  944. </td>
  945. </tr>
  946. </table>
  947. </div>
  948. <!-- <br /> -->
  949. <div class="flex justify-between items-start">
  950. <div
  951. v-if="userInfo.Organization !== 'PrimePac'"
  952. class="note-form-area"
  953. >
  954. <div class="sub-form-title">注意事项:</div>
  955. <div class="">
  956. <div class="label">印刷质量:</div>
  957. <div class="value">{{ form.field12 }}</div>
  958. </div>
  959. <div class="">
  960. <div class="label">产品质量:</div>
  961. <div class="value">{{ form.field13 }}</div>
  962. </div>
  963. <div class="">
  964. <div class="label">质量承诺:</div>
  965. <div class="value">{{ form.field10 }}</div>
  966. </div>
  967. <div class="">
  968. <div class="label">箱子箱唛:</div>
  969. <div class="value">{{ form.field11 }}</div>
  970. </div>
  971. </div>
  972. <div v-else></div>
  973. <div class="product-total-table">
  974. <div class="total-item flex">
  975. <div class="label">小计&nbsp;</div>
  976. <div class="value">
  977. {{ currentCurrency.country
  978. }}{{ currentCurrency.symbol }}&nbsp;{{
  979. toFixed(subTotal, computedDeci)
  980. }}
  981. </div>
  982. </div>
  983. <div class="total-item flex">
  984. <div class="label">合计&nbsp;</div>
  985. <div class="value">
  986. {{ currentCurrency.country
  987. }}{{ currentCurrency.symbol }}&nbsp;{{
  988. toFixed(grandTotal, computedDeci)
  989. }}
  990. </div>
  991. </div>
  992. </div>
  993. </div>
  994. <br />
  995. <div class="sub-form-title">服务条款</div>
  996. <template v-if="currentCompany === 'PangeaTaxReimbursement'">
  997. <div class="rule-item">
  998. 一、合同价为含税价,税率为: {{ form.field4 }} %
  999. </div>
  1000. <div class="rule-item">二、运费条款: {{ form.field5 }}</div>
  1001. </template>
  1002. <template
  1003. v-if="['PrimePacCommon', 'PrimePacSoft'].includes(currentCompany)"
  1004. >
  1005. <div class="rule-item">
  1006. 一、本采购订单签署原件一式两份,双方各持一份。经双方代表签字或盖章即可生效,并具有同等法律效力。
  1007. </div>
  1008. <div class="rule-item flex nowrap">
  1009. 二、以上价格已含所有产品的制作费、包装费;由
  1010. <span class="attention">{{ form.field5 }}</span>
  1011. 运费送货到广州甲方指定的卸货地点,不含税,运费届时实报实销。
  1012. </div>
  1013. <div class="rule-item">
  1014. 三、印刷及工艺要求:乙方需按照甲方图稿或指定样品进行生产,颜色对照潘通色卡或指定样品。
  1015. </div>
  1016. <div class="rule-item">
  1017. 四、付款形式:
  1018. <span class="attention">{{ form.Supplier_Payment_Terms }}</span>
  1019. 。甲方在乙方完成大货时,先寄大货样品给乙方确认,确认后付清剩余尾款。甲方通过银行转帐的方式付款,乙方账户信息如上。
  1020. </div>
  1021. <div class="rule-item">
  1022. 五、出货标准:五层出口空白硬纸箱,箱内套防潮袋。如实际出货包装与合约要求不符,甲方有权拒收整批货物。
  1023. </div>
  1024. <div class="rule-item">
  1025. 六、订货时间:自合同成立,甲方支付定金并确认图稿后算起。
  1026. </div>
  1027. <div class="rule-item">
  1028. 七、交货期限:自确认图稿时间算起,乙方应于
  1029. <span class="attention">{{ form.field6 }}</span>
  1030. 前生产好产品,甲方确认并支付剩余款项后,乙方在约定时间内安排发出剩余产品到甲方收货地址。
  1031. </div>
  1032. </template>
  1033. <div
  1034. v-for="(item, index) in currentServiceRule"
  1035. :key="index"
  1036. class="rule-item"
  1037. :class="[{ sub: typeof item === 'object' }]"
  1038. v-html="typeof item === 'object' ? item.value : item"
  1039. ></div>
  1040. <template
  1041. v-if="['PrimePacCommon', 'PrimePacSoft'].includes(currentCompany)"
  1042. >
  1043. <div class="sub-form-title">附录</div>
  1044. <div
  1045. v-for="(item, index) in appendixData"
  1046. :key="index"
  1047. class="rule-item"
  1048. :class="[{ sub: typeof item === 'object' }]"
  1049. v-html="typeof item === 'object' ? item.value : item"
  1050. ></div>
  1051. </template>
  1052. <div
  1053. v-if="currentCompany === 'PrimePacCommon'"
  1054. class="flex items-stretch PrimePac-table"
  1055. >
  1056. <div class="flex flex-col items-stretch">
  1057. <div class="column-item flex justify-center">制作要求</div>
  1058. <div class="flex-auto column-item flex justify-center">
  1059. 产品外观要求
  1060. </div>
  1061. </div>
  1062. <div class="flex-auto flex flex-col items-stretch">
  1063. <div
  1064. v-for="(item, index) in PrimePacCommonRuleTableData"
  1065. :key="index"
  1066. class="flex items-stretch flex-auto"
  1067. >
  1068. <div class="column-item flex justify-center">
  1069. {{ item.project }}
  1070. </div>
  1071. <div class="column-item flex-auto flex justify-center">
  1072. {{ item.method }}
  1073. </div>
  1074. </div>
  1075. </div>
  1076. </div>
  1077. <div
  1078. v-if="currentCompany === 'PrimePacSoft'"
  1079. class="flex flex-col items-stretch PrimePac-table"
  1080. >
  1081. <div class="flex items-stretch">
  1082. <div class="flex flex-col items-stretch">
  1083. <div class="column-item flex-auto flex justify-center">
  1084. 制作要求
  1085. </div>
  1086. </div>
  1087. <div class="flex-auto flex flex-col items-stretch">
  1088. <div
  1089. v-for="(item, index) in PrimePacSoftRuleTableData1"
  1090. :key="index"
  1091. class="flex items-stretch flex-auto"
  1092. >
  1093. <div class="column-item flex justify-center">
  1094. {{ item.project }}
  1095. </div>
  1096. <div class="column-item flex-auto flex justify-center">
  1097. {{ item.method }}
  1098. </div>
  1099. </div>
  1100. </div>
  1101. </div>
  1102. <div class="flex items-stretch">
  1103. <div class="flex flex-col items-stretch">
  1104. <div class="column-item flex-auto flex justify-center">
  1105. 产品技术要求
  1106. </div>
  1107. </div>
  1108. <div class="flex-auto flex flex-col items-stretch">
  1109. <div
  1110. v-for="(item, index) in PrimePacSoftRuleTableData2"
  1111. :key="index"
  1112. class="flex items-stretch flex-auto"
  1113. >
  1114. <div class="column-item flex justify-center">
  1115. {{ item.project }}
  1116. </div>
  1117. <div class="column-item flex-auto flex justify-center">
  1118. {{ item.method }}
  1119. </div>
  1120. </div>
  1121. </div>
  1122. </div>
  1123. </div>
  1124. <br />
  1125. <div class="signature-area">
  1126. <div class="company-seal"></div>
  1127. <div
  1128. style="align-items: flex-end"
  1129. :class="{
  1130. flex: ['PrimePacCommon', 'PrimePacSoft'].includes(
  1131. currentCompany,
  1132. ),
  1133. between: ['PrimePacCommon', 'PrimePacSoft'].includes(
  1134. currentCompany,
  1135. ),
  1136. }"
  1137. >
  1138. <div class="first-party">
  1139. <div
  1140. class="flex"
  1141. style="align-items: flex-end"
  1142. >
  1143. <div v-show="!computedCompany.label.includes('Pangea')">
  1144. 甲方(盖章):
  1145. </div>
  1146. <div
  1147. class="sign-wrap"
  1148. :class="{
  1149. pangea: computedCompany.label.includes('Pangea'),
  1150. }"
  1151. >
  1152. <img
  1153. v-if="computedCompany.signPath"
  1154. :src="computedCompany.signPath"
  1155. />
  1156. </div>
  1157. </div>
  1158. <div class="">代表人: {{ userInfo.full_name }}</div>
  1159. <div class="">日期: {{ form.PO_Date }}</div>
  1160. </div>
  1161. <div class="second-party">
  1162. <div class="">乙方(盖章):</div>
  1163. </div>
  1164. </div>
  1165. </div>
  1166. </div>
  1167. </div>
  1168. <div
  1169. v-if="computedCompany.taxReimbursement && false"
  1170. class="pdf-wrap"
  1171. >
  1172. <div
  1173. ref="pdfElement2"
  1174. class="preview-area2"
  1175. >
  1176. <div class="supplier-name">
  1177. {{ computedVendor.Suppliers_Name || computedVendor.Vendor_Name }}
  1178. </div>
  1179. <div class="billing-addr">
  1180. {{ computedVendor.Billing_Address || '' }}
  1181. </div>
  1182. <div class="flex justify-around contact-info">
  1183. <div class="flex">
  1184. <div>Tel No.:</div>
  1185. <div>&nbsp;{{ computedVendor.Phone }}</div>
  1186. </div>
  1187. <div class="flex justify-center">
  1188. <div>E-mail:</div>
  1189. <div class="">&nbsp;{{ computedVendor.Email }}</div>
  1190. </div>
  1191. </div>
  1192. <div class="base-info-area">
  1193. <div class="flex">
  1194. <div class="flex items-start left">
  1195. <div class="base-info-label">TO:</div>
  1196. <div
  1197. v-if="currentCompany === 'AZYTaxReimbursement'"
  1198. class="base-info-value"
  1199. >
  1200. Azy Trading Pty Ltd
  1201. </div>
  1202. <div
  1203. v-else-if="currentCompany === 'FOTTaxReimbursement'"
  1204. class="base-info-value"
  1205. >
  1206. Fair Ocean Trading Australia Pty Ltd
  1207. </div>
  1208. </div>
  1209. <div class="right flex">
  1210. <div class="base-info-label">Date:</div>
  1211. <div class="base-info-value">{{ form.PO_Date }}</div>
  1212. </div>
  1213. </div>
  1214. <div class="flex items-start">
  1215. <div class="left flex items-start">
  1216. <div class="base-info-label">ADD:</div>
  1217. <div>
  1218. <div
  1219. v-if="currentCompany === 'AZYTaxReimbursement'"
  1220. class="base-info-value"
  1221. >
  1222. UNIT 12,21/F WAYSON COMM BLDG NO 28 CONNAUGHT RD WEST SHEUNG
  1223. WAN, HK
  1224. </div>
  1225. <div
  1226. v-else-if="currentCompany === 'FOTTaxReimbursement'"
  1227. class="base-info-value"
  1228. >
  1229. 15/10 Chilvers Road, Thornleigh, NSW 2120
  1230. </div>
  1231. </div>
  1232. </div>
  1233. <div class="right flex">
  1234. <div class="base-info-label">P/I. NO.</div>
  1235. <div class="base-info-value">{{ longPONumber }}</div>
  1236. </div>
  1237. </div>
  1238. <div class="flex items-start">
  1239. <div class="left flex">
  1240. <div class="base-info-label">ATTN:</div>
  1241. <div class="base-info-value">Accounts</div>
  1242. </div>
  1243. <div class="right flex">
  1244. <div class="base-info-label">Reference:</div>
  1245. <div class="base-info-value">{{ PONumber }}</div>
  1246. </div>
  1247. </div>
  1248. <div class="flex items-start">
  1249. <div class="flex left">
  1250. <template v-if="currentCompany === 'FOTTaxReimbursement'">
  1251. <div class="base-info-label">TEL NO:</div>
  1252. <div class="base-info-value">02 9008 1322</div>
  1253. </template>
  1254. <div v-else></div>
  1255. </div>
  1256. <div class="right flex">
  1257. <div class="base-info-label">Payment Term:</div>
  1258. <div class="base-info-value">
  1259. {{ computedVendor.Supplier_Payment_Terms }}
  1260. </div>
  1261. </div>
  1262. </div>
  1263. </div>
  1264. <div class="table-title">PROFORMA INVOICE</div>
  1265. <div class="product-table">
  1266. <table cellspacing="0">
  1267. <tr>
  1268. <th>ITEM</th>
  1269. <th>DESCRIPTION</th>
  1270. <th>QTY(pcs)</th>
  1271. <th>UNIT PRICE</th>
  1272. <th>TOPTAL VALUE</th>
  1273. </tr>
  1274. <tr
  1275. v-for="(product, index) in form.productList"
  1276. :key="index"
  1277. >
  1278. <td>
  1279. <div>{{ product.name }}</div>
  1280. </td>
  1281. <td>
  1282. <div class="desc">{{ product.desc }}</div>
  1283. </td>
  1284. <td>
  1285. {{ product.quantity }}
  1286. </td>
  1287. <td>
  1288. {{ currentCurrency.country
  1289. }}{{ currentCurrency.symbol }}&nbsp;{{
  1290. toFixed(Number(product.rate), computedDeci)
  1291. }}
  1292. </td>
  1293. <td>
  1294. {{ currentCurrency.country
  1295. }}{{ currentCurrency.symbol }}&nbsp;{{
  1296. toFixed(Number(product.amount), computedDeci)
  1297. }}
  1298. </td>
  1299. </tr>
  1300. </table>
  1301. <div class="flex justify-end">
  1302. <div
  1303. class="flex"
  1304. style="margin-top: 10pt"
  1305. >
  1306. <div style="margin: 0 100pt 0 0">TOTAL</div>
  1307. <div>
  1308. {{ currentCurrency.country
  1309. }}{{ currentCurrency.symbol }}&nbsp;{{ subTotal }}
  1310. </div>
  1311. </div>
  1312. </div>
  1313. </div>
  1314. <br />
  1315. <div class="bank-info-area">
  1316. <div class="flex">
  1317. <div>Bank Information</div>
  1318. <div></div>
  1319. </div>
  1320. <div class="flex">
  1321. <div class="bank-info-label">Beneficiary:</div>
  1322. <div class="bank-info-value">
  1323. {{ computedVendor.Suppliers_Name }}dd
  1324. </div>
  1325. </div>
  1326. <div class="flex">
  1327. <div class="bank-info-label">Bank:</div>
  1328. <div class="bank-info-value">
  1329. {{ computedVendor.Bank_Branch_Name }}
  1330. </div>
  1331. </div>
  1332. <div class="flex">
  1333. <div class="bank-info-label">Bank Add:</div>
  1334. <div class="bank-info-value">{{}}</div>
  1335. </div>
  1336. <div class="flex">
  1337. <div class="bank-info-label">A/C No.:</div>
  1338. <div class="bank-info-value">
  1339. {{ computedVendor.Bank_Account }}
  1340. </div>
  1341. </div>
  1342. <div class="flex">
  1343. <div class="bank-info-label">Bank Code:</div>
  1344. <div class="bank-info-value">{{}}</div>
  1345. </div>
  1346. <div class="flex">
  1347. <div class="bank-info-label">SWIFT CODE:</div>
  1348. <div class="bank-info-value">
  1349. {{ computedVendor.Swift_Code_IBAN }}
  1350. </div>
  1351. </div>
  1352. <div class="flex">
  1353. <div class="bank-info-label">Add:</div>
  1354. <div class="bank-info-value">{{}}</div>
  1355. </div>
  1356. </div>
  1357. <br />
  1358. <div class="flex justify-between items-start">
  1359. <div class="">
  1360. <div class="">BUYERS' SIGNATURE</div>
  1361. <div class="sign-wrap">
  1362. <img
  1363. v-if="computedCompany.signPath"
  1364. :src="computedCompany.signPath"
  1365. />
  1366. </div>
  1367. </div>
  1368. <div class="">
  1369. <div class="">SELLER'S SIGNATURE</div>
  1370. </div>
  1371. </div>
  1372. </div>
  1373. </div>
  1374. </div>
  1375. </div>
  1376. </template>
  1377. <script lang="ts" setup>
  1378. import { computed, defineComponent, ref, unref, watch } from 'vue'
  1379. import { useRoute } from 'vue-router'
  1380. import {
  1381. ElButton,
  1382. ElSelectV2,
  1383. ElSelect,
  1384. ElOption,
  1385. ElIcon,
  1386. ElInput,
  1387. ElForm,
  1388. ElFormItem,
  1389. ElDatePicker,
  1390. ElMessage,
  1391. ElNotification,
  1392. ElRadioGroup,
  1393. ElRadio,
  1394. ElMessageBox,
  1395. ElTooltip,
  1396. } from 'element-plus'
  1397. import type { FormInstance } from 'element-plus'
  1398. import { ShoppingCart, FolderAdd, Switch } from '@element-plus/icons-vue'
  1399. import request from '@/utils/axios'
  1400. import dayjs from 'dayjs'
  1401. import jspdf from 'jspdf'
  1402. import html2canvas from 'html2canvas'
  1403. import utils from '@/utils/index'
  1404. import variables from '@/assets/css/var.module.scss'
  1405. import {
  1406. ServiceTypeKeyEnum,
  1407. ISelectItem,
  1408. IProductItem,
  1409. IUser,
  1410. IVendorItem,
  1411. IRecommandVendor,
  1412. IForm,
  1413. } from '@/interface'
  1414. import {
  1415. currencyList,
  1416. orderTypeList,
  1417. formRule,
  1418. emptyProductItem,
  1419. PrimePacList,
  1420. companyList,
  1421. serviceRule,
  1422. appendixData,
  1423. warehouseList,
  1424. productBlackList,
  1425. PrimePacSoftRuleTableData2,
  1426. PrimePacSoftRuleTableData1,
  1427. PrimePacCommonRuleTableData,
  1428. } from './const'
  1429. defineComponent({
  1430. name: 'PurchaseOrderEdit',
  1431. })
  1432. computed(() => {
  1433. return variables
  1434. })
  1435. const formVisible = ref(true)
  1436. const loading = ref(false)
  1437. // 订单ID. 例如 5757019000000683001, 不是串号.
  1438. const POID = ref('')
  1439. // po 串号. 例如 PO2025
  1440. const PONumber = ref('')
  1441. // po 长串号. 例如 ZCPO2025
  1442. const longPONumber = ref('')
  1443. const mainForm = ref<FormInstance>()
  1444. const checkForm = function (formEl: FormInstance | undefined) {
  1445. if (!formEl) return
  1446. formEl.validate((valid, fields) => {
  1447. if (valid) {
  1448. submit()
  1449. } else {
  1450. console.log('check form has not pass!', fields)
  1451. ElMessage.error('请检查表单必填项')
  1452. }
  1453. })
  1454. }
  1455. const submit = () => {
  1456. loading.value = true
  1457. createPurchaseOrders()
  1458. .then(() => {
  1459. // console.log(res)
  1460. getPurchaseOrdersData()
  1461. .then(() => {
  1462. generatePDF()
  1463. .then(() => {
  1464. ElNotification({
  1465. duration: 0,
  1466. type: 'success',
  1467. title: '任务已成功处理',
  1468. message: '本页面将自动跳转',
  1469. })
  1470. const url =
  1471. import.meta.env.VITE_PO_PATH +
  1472. POID.value +
  1473. import.meta.env.VITE_PO_APPEND
  1474. setTimeout(() => {
  1475. window.location.replace(url)
  1476. }, 1000)
  1477. })
  1478. .finally(() => {
  1479. loading.value = false
  1480. })
  1481. })
  1482. .catch(() => {
  1483. // loading.value = false
  1484. const msg = '获取PO详情失败, 未能正确生成PDF'
  1485. console.log(msg)
  1486. ElNotification({ duration: 0, title: msg, type: 'error' })
  1487. })
  1488. })
  1489. .catch(() => {
  1490. // loading.value = false
  1491. const msg = '创建PO失败'
  1492. console.log(msg)
  1493. ElNotification({ duration: 0, title: msg, type: 'error' })
  1494. })
  1495. }
  1496. const pdfElement = ref()
  1497. const pdfElement2 = ref()
  1498. const generatePDF = (ele = pdfElement, isFirstTime = true) => {
  1499. const A4_WIDTH = 592.28
  1500. const A4_HEIGHT = 841.89
  1501. let imageWrapper = unref(ele) // 获取DOM
  1502. // let pageHeight = (imageWrapper.scrollWidth / A4_WIDTH) * A4_HEIGHT
  1503. let pageHeight = (imageWrapper.clientWidth / A4_WIDTH) * A4_HEIGHT
  1504. let lableListID = imageWrapper.querySelectorAll('#pdfElement > div')
  1505. // 进行分割操作,当dom内容已超出a4的高度,则将该dom前插入一个空dom,把他挤下去,分割
  1506. for (let i = 0; i < lableListID.length; i++) {
  1507. let multiple = Math.ceil(
  1508. (lableListID[i].offsetTop + lableListID[i].offsetHeight) / pageHeight,
  1509. )
  1510. if (isSplit(lableListID, i, multiple * pageHeight)) {
  1511. let divParent = lableListID[i].parentNode // 获取该div的父节点
  1512. let newNode = document.createElement('div')
  1513. newNode.className = 'empty-div'
  1514. newNode.style.background = '#fff'
  1515. let _H =
  1516. multiple * pageHeight -
  1517. (lableListID[i].offsetTop + lableListID[i].offsetHeight)
  1518. //留白
  1519. newNode.style.height = _H + 40 + 'px'
  1520. newNode.style.width = '100%'
  1521. let next = lableListID[i].nextSibling // 获取div的下一个兄弟节点
  1522. // 判断兄弟节点是否存在
  1523. if (next) {
  1524. // 存在则将新节点插入到div的下一个兄弟节点之前,即div之后
  1525. divParent.insertBefore(newNode, next)
  1526. } else {
  1527. // 不存在则直接添加到最后,appendChild默认添加到divParent的最后
  1528. divParent.appendChild(newNode)
  1529. }
  1530. }
  1531. }
  1532. return new Promise((resolve) => {
  1533. html2canvas(imageWrapper, {
  1534. allowTaint: true,
  1535. useCORS: true,
  1536. backgroundColor: '#fff', //一定要设背景颜色,否则有的浏览器就会变花~,比如Edge
  1537. scale: 3, // 缩放倍率调整清晰度
  1538. }).then((canvas) => {
  1539. let pdf = new jspdf('p', 'mm', 'a4') //A4纸,纵向
  1540. let ctx = canvas.getContext('2d'),
  1541. a4ContentWidth = 190,
  1542. a4ContentHeight = 277, //A4大小,210mm x 297mm,四边各保留10mm的边距,显示区域190x277
  1543. imgHeight = Math.floor(
  1544. (a4ContentHeight / a4ContentWidth) * canvas.width,
  1545. ), //按A4显示比例换算一页图像的像素高度
  1546. renderedHeight = 0
  1547. while (renderedHeight < canvas.height) {
  1548. let page = document.createElement('canvas')
  1549. page.width = canvas.width
  1550. page.height = Math.min(imgHeight, canvas.height - renderedHeight) //可能内容不足一页
  1551. //用getImageData剪裁指定区域,并画到前面创建的canvas对象中
  1552. // @ts-ignore: Object is possibly 'null'.
  1553. page
  1554. .getContext('2d')
  1555. .putImageData(
  1556. ctx!.getImageData(
  1557. 0,
  1558. renderedHeight,
  1559. canvas.width,
  1560. Math.min(imgHeight, canvas.height - renderedHeight),
  1561. ),
  1562. 0,
  1563. 0,
  1564. )
  1565. // document.body.appendChild(page)
  1566. pdf.addImage(
  1567. page.toDataURL('image/jpeg', 0.5),
  1568. 'JPEG',
  1569. 10,
  1570. 10,
  1571. a4ContentWidth,
  1572. Math.min(
  1573. a4ContentHeight,
  1574. a4ContentWidth * (page.height / page.width),
  1575. ),
  1576. ) //添加图像到页面,保留10mm边距
  1577. renderedHeight += imgHeight
  1578. if (renderedHeight < canvas.height) pdf.addPage() //如果后面还有内容,添加一个空页
  1579. }
  1580. const prefix =
  1581. `${PONumber.value}-${computedVendor.value.label}` +
  1582. (form.value.Title?.length ? `-${form.value.Title}` : '')
  1583. const fileName = isFirstTime ? prefix : prefix + '_2'
  1584. // sendPDF(pdf.output('datauristring'), fileName)
  1585. // .then(() => {
  1586. resolve(true)
  1587. // })
  1588. // 本地备份一下
  1589. pdf.save(fileName + '.pdf')
  1590. })
  1591. })
  1592. }
  1593. const isSplit = function (nodes: any, index: number, pageHeight: number) {
  1594. // 计算当前这块dom是否跨越了a4大小,以此分割
  1595. if (
  1596. nodes[index].offsetTop + nodes[index].offsetHeight < pageHeight &&
  1597. nodes[index + 1] &&
  1598. nodes[index + 1].offsetTop + nodes[index + 1].offsetHeight > pageHeight
  1599. ) {
  1600. return true
  1601. }
  1602. return false
  1603. }
  1604. // const sendPDF = function (file: string, filename = `attachment_file`) {
  1605. // const temp = file.split(',')
  1606. // // @ts-ignore: Object is possibly 'null'.
  1607. // const mimeType = temp[0].match(/:(.*?);/)[1]
  1608. // let extName = mimeType.split('/')[1]
  1609. // let bstr = window.atob(temp[1])
  1610. // let n = bstr.length
  1611. // let result = new Uint8Array(n)
  1612. // while (n--) {
  1613. // result[n] = bstr.charCodeAt(n)
  1614. // }
  1615. // const data = {
  1616. // id: POID.value,
  1617. // file: new File([result], `${filename}.${extName}`, { type: mimeType }),
  1618. // }
  1619. // return new Promise((resolve, reject) => {
  1620. // request
  1621. // .post('/Purchase_orders/uploadAttachmentFile', data, {
  1622. // headers: {
  1623. // 'Content-Type': 'multipart/form-data',
  1624. // },
  1625. // })
  1626. // .then((response) => {
  1627. // if (response.data.code !== 1) {
  1628. // const msg = '自动创建附件失败'
  1629. // ElNotification({ duration: 0, title: msg, type: 'error' })
  1630. // reject(msg)
  1631. // return
  1632. // }
  1633. // ElNotification({
  1634. // duration: 0,
  1635. // title: '自动创建 PDF 成功',
  1636. // type: 'success',
  1637. // })
  1638. // resolve(true)
  1639. // })
  1640. // .catch((e) => {
  1641. // reject(e)
  1642. // })
  1643. // })
  1644. // }
  1645. const createPurchaseOrders = function () {
  1646. const data = JSON.parse(JSON.stringify(unref(form)))
  1647. data.Status = 'Created'
  1648. data.Sub_Total = subTotal.value
  1649. data.Total_Taxes = 0
  1650. data.Total_Discount = totalDiscount.value
  1651. data.Adjustment = Number(adjustment.value)
  1652. data.Grand_Total = grandTotal.value
  1653. data.Subject = '这里不用填'
  1654. data.Created_By = {
  1655. id: userInfo.value.users_id || route.query.user,
  1656. name: userInfo.value.full_name || '',
  1657. }
  1658. data.Owner = {
  1659. id: userInfo.value.users_id || route.query.user,
  1660. name: userInfo.value.full_name || '',
  1661. email: userInfo.value.email || '',
  1662. }
  1663. data.Vendor_Name = {
  1664. id: computedVendor.value.value,
  1665. name: computedVendor.value.label,
  1666. }
  1667. data.Related_Sales_Order = {
  1668. id: form.value.saleOrderId,
  1669. name: form.value.Title,
  1670. }
  1671. data.Purchase_Items = data.productList.map((item: any) => {
  1672. return {
  1673. Warehouse: item.Warehouse || '',
  1674. Quantity: item.quantity,
  1675. Discount: item.discount || 0,
  1676. List_Price: item.rate,
  1677. Tax: 0,
  1678. total: item.amount,
  1679. total_after_discount: Number(item.amount) - Number(item.discount),
  1680. Net_Total: Number(item.amount) - Number(item.discount),
  1681. Description: item.desc,
  1682. Requirement: item.requirement,
  1683. line_tax: [],
  1684. // book: '',
  1685. // id: item.id,
  1686. product: {
  1687. // name: item.name,
  1688. id: item.id,
  1689. // Product_Code: item.Product_Code,
  1690. },
  1691. Product_Name: {
  1692. id: item.id,
  1693. },
  1694. // 这两个是crm有的, 但是文档没有
  1695. List_Price_Non_Currency: item.rate,
  1696. Price_Book_Name: '',
  1697. }
  1698. })
  1699. if (data.productList) delete data.productList
  1700. return new Promise((resolve, reject) => {
  1701. request
  1702. .post('/Purchase_orders/createPurchaseOrders', data, {})
  1703. .then((response) => {
  1704. if (response.data.code !== 1) return
  1705. const res = response.data.result
  1706. if (res.data && res.data.length && res.data[0].code === 'SUCCESS') {
  1707. POID.value = res.data[0].details?.id || ''
  1708. resolve(res.data[0].details?.id)
  1709. ElNotification({
  1710. duration: 0,
  1711. title: '创建 Purchase Order 成功',
  1712. type: 'success',
  1713. })
  1714. } else {
  1715. ElNotification({
  1716. duration: 0,
  1717. title: '未能成功创建PO, 请稍后重试或者联系管理员',
  1718. type: 'error',
  1719. })
  1720. }
  1721. reject('未能成功创建PO')
  1722. })
  1723. .catch((e) => {
  1724. reject(e)
  1725. })
  1726. })
  1727. }
  1728. const getPurchaseOrdersData = function () {
  1729. return new Promise((resolve, reject) => {
  1730. request
  1731. .post('/purchase_orders/getPurchaseOrdersData', {
  1732. id: POID.value,
  1733. })
  1734. .then((response) => {
  1735. if (response.data.code !== 1) {
  1736. reject(false)
  1737. return
  1738. }
  1739. const res = Array.isArray(response.data.result)
  1740. ? response.data.result[0]
  1741. : response.data.result
  1742. longPONumber.value = res.PO_Number || ''
  1743. PONumber.value = res.Purchase_Order_Number || ''
  1744. resolve(true)
  1745. })
  1746. .catch((e) => {
  1747. reject(e)
  1748. })
  1749. })
  1750. }
  1751. const currentCurrency = computed(() => {
  1752. const temp = currencyList.value.filter((i) => i.label === form.value.Currency)
  1753. // 2是人民币
  1754. return temp.length ? temp[0] : temp[2]
  1755. })
  1756. const form = ref<IForm>({
  1757. Order_Type: '',
  1758. Artwork_Link: '',
  1759. Currency: 'CNY',
  1760. // 订单号
  1761. saleOrderId: '',
  1762. Reference: '',
  1763. // 日期
  1764. PO_Date: '',
  1765. // 付款方式
  1766. Supplier_Payment_Terms: '-None-',
  1767. // 参考, so的job name
  1768. Title: '',
  1769. // 收货地址
  1770. field9: '广州市越秀区八旗二马路广东航运大厦1904室 邮编510110',
  1771. // 收件人
  1772. field7: '',
  1773. // 联系电话
  1774. field8: '18925020659',
  1775. // 工厂交货日期
  1776. field6: '',
  1777. productList: [
  1778. {
  1779. name: '',
  1780. id: '',
  1781. quantity: '',
  1782. rate: '',
  1783. requirement: '',
  1784. desc: '',
  1785. amount: 0,
  1786. discount: '',
  1787. candidate: [],
  1788. },
  1789. ] as IProductItem[],
  1790. // 印刷质量
  1791. field12: '',
  1792. // 产品质量
  1793. field13: '',
  1794. // 质量承诺
  1795. field10: '',
  1796. // 箱子箱唛
  1797. field11: '',
  1798. // 税率
  1799. field4: '0',
  1800. // 运费条款
  1801. field5: '供应商承担',
  1802. currentVendor: '',
  1803. Delivery_Details: '',
  1804. })
  1805. const addRow = function () {
  1806. form.value.productList.push(JSON.parse(JSON.stringify(emptyProductItem)))
  1807. }
  1808. const keyNeedCompute = ['quantity', 'rate']
  1809. const onInputChange = function (e: any, obj: IProductItem, key: string) {
  1810. if (typeof e === 'string') {
  1811. if (e.length) {
  1812. // 强制转换为数字类型
  1813. obj[key] = Math.round(utils.multiply(Number(e), 1000)) / 1000
  1814. // 计算每行的总额
  1815. if (keyNeedCompute.includes(key)) {
  1816. obj.amount = utils.multiply(Number(obj.quantity), Number(obj.rate))
  1817. }
  1818. } else {
  1819. // obj[key] = minValue
  1820. }
  1821. }
  1822. }
  1823. const onProductSelect = function (e: any, product: IProductItem) {
  1824. if (e) {
  1825. const temp = product.candidate.filter((i) => i.value === e)
  1826. if (temp.length) {
  1827. product.name = temp[0].label
  1828. product.Product_Code = temp[0].Product_Code // 没有传出去, 实际上没用, 在本页面处于废弃状态
  1829. }
  1830. getProductData(product.id).then((ctx) => {
  1831. product.requirement =
  1832. userInfo.value.Organization === 'PrimePac'
  1833. ? '产品名称:\n尺寸:\n材质:\n工艺:\n颜色:\n其他备注:'
  1834. : ctx.CF3 || ''
  1835. product.CF_Product_Type = ctx.CF_Product_Type || ''
  1836. })
  1837. } else {
  1838. product.name = ''
  1839. }
  1840. }
  1841. // 小计
  1842. const subTotal = computed(() => {
  1843. return form.value.productList.reduce((total, current) => {
  1844. total = total + Number(current.amount)
  1845. return total
  1846. }, 0)
  1847. })
  1848. // 总优惠额度
  1849. const totalDiscount = computed(() => {
  1850. return form.value.productList.reduce((total, current) => {
  1851. total = total + Number(current.discount)
  1852. return total
  1853. }, 0)
  1854. })
  1855. // 价格统计修正值
  1856. const adjustment = ref<number | string>('')
  1857. // 总计
  1858. const grandTotal = computed(() => {
  1859. return subTotal.value - totalDiscount.value + Number(adjustment.value)
  1860. })
  1861. const productLoading = ref(false)
  1862. const getProductList = utils.debounce(
  1863. (keyword: string, target: IProductItem) => {
  1864. const key = keyword.trim()
  1865. if (!key.length) return
  1866. productLoading.value = true
  1867. const data = {
  1868. value: key,
  1869. name: 'Products',
  1870. api_name: 'Product_Name',
  1871. contains: 'contains',
  1872. page: 1,
  1873. limit: 20,
  1874. }
  1875. getSearchData(data)
  1876. .then((response) => {
  1877. if (response.data.code !== 1) return
  1878. const res = response.data.result
  1879. target.candidate = res.data.map((item: any) => {
  1880. return {
  1881. ...item,
  1882. label: item.Product_Name,
  1883. value: item.products_id || item.id,
  1884. }
  1885. })
  1886. })
  1887. .finally(() => {
  1888. productLoading.value = false
  1889. })
  1890. },
  1891. 1000,
  1892. )
  1893. const toFixed = function (value: number, ratio = 2) {
  1894. let r = 100
  1895. if (ratio === 3) {
  1896. r = 1000
  1897. }
  1898. return utils.toFixed(value, r)
  1899. }
  1900. const vendorList = ref<IVendorItem[]>([])
  1901. const computedVendor = computed(() => {
  1902. const temp = vendorList.value.filter(
  1903. (i) => i.value === form.value.currentVendor,
  1904. )
  1905. return temp.length
  1906. ? temp[0]
  1907. : {
  1908. Primary_Contact_name: '',
  1909. PDF_display: '',
  1910. PDF_display2: '',
  1911. label: '',
  1912. value: '',
  1913. Payment_Terms: '',
  1914. High_Risk_Supplier: false,
  1915. }
  1916. })
  1917. watch(computedVendor, () => {
  1918. if (
  1919. computedVendor.value.Payment_Terms &&
  1920. computedVendor.value.Payment_Terms.length
  1921. ) {
  1922. form.value.Supplier_Payment_Terms = computedVendor.value.Payment_Terms
  1923. // 选择供应商后, 对应的currency赋值到界面的Currency选项.
  1924. const temp: any[] = vendorList.value.filter(
  1925. (i) => i.value === form.value.currentVendor,
  1926. )
  1927. if (temp.length) {
  1928. form.value.Currency = temp[0].Currency || 'CNY'
  1929. }
  1930. }
  1931. })
  1932. const vendorLoading = ref(false)
  1933. const getSupplierLists = function (string: string) {
  1934. return new Promise((resolve, reject) => {
  1935. const keyword = string.trim() || ''
  1936. if (!keyword.length) {
  1937. reject('false')
  1938. return
  1939. }
  1940. const query = {
  1941. title: 'Vendors',
  1942. comm: {
  1943. group_operator: 'OR',
  1944. group: [
  1945. {
  1946. comparator: 'contains',
  1947. field: {
  1948. api_name: 'Vendor_Name',
  1949. },
  1950. value: keyword,
  1951. },
  1952. {
  1953. comparator: 'contains',
  1954. field: {
  1955. api_name: 'Previous_Supplier_Name',
  1956. },
  1957. value: keyword,
  1958. },
  1959. ],
  1960. },
  1961. }
  1962. vendorLoading.value = true
  1963. getSearchData2(query)
  1964. .then((response) => {
  1965. if (response.data.code !== 1) return false
  1966. const res = response.data.result || { data: [] }
  1967. vendorList.value = res.data
  1968. .filter((i: any) => !i.Hide_Record)
  1969. .map((i: any) => {
  1970. return {
  1971. ...i,
  1972. label:
  1973. (i.Suppliers_Name || i.Vendor_Name) +
  1974. (i.Previous_Supplier_Name && i.Previous_Supplier_Name != null
  1975. ? ` (曾用名: ${i.Previous_Supplier_Name})`
  1976. : ''),
  1977. value: i.supplier_id || i.id,
  1978. Primary_Contact_name: i.Primary_Contact_name || '',
  1979. PDF_display: i.PDF_display || '',
  1980. PDF_display2: i.PDF_display2 || '',
  1981. }
  1982. })
  1983. if (
  1984. vendorList.value.length === 1 &&
  1985. vendorList.value[0].High_Risk_Supplier === true
  1986. ) {
  1987. ElMessageBox.alert(
  1988. '请注意该供应商在我们黑名单中。<br>Please note that this supplier is in our black list.',
  1989. 'Alert',
  1990. {
  1991. dangerouslyUseHTMLString: true,
  1992. },
  1993. )
  1994. }
  1995. vendorLoading.value = false
  1996. loading.value = false
  1997. resolve(true)
  1998. })
  1999. .catch((e) => reject(e))
  2000. })
  2001. }
  2002. const quickSelectSupplier = function (item: IRecommandVendor) {
  2003. form.value.currentVendor = item.id
  2004. loading.value = true
  2005. getSupplierLists(item.name)
  2006. }
  2007. const getSearchData = async function (p: any) {
  2008. return await request
  2009. .post('/common/getPublicLists', p, {
  2010. headers: { 'Content-Type': 'multipart/form-data' },
  2011. })
  2012. .then((response) => {
  2013. return response
  2014. })
  2015. }
  2016. const getSearchData2 = async function (p: any) {
  2017. return await request.post('/common/getPublicListsAll', p).then((response) => {
  2018. return response
  2019. })
  2020. }
  2021. const computedCompanyList = computed(() => {
  2022. return userInfo.value.Organization === 'PrimePac'
  2023. ? PrimePacList.value
  2024. : companyList.value
  2025. })
  2026. // 切换模版后的处理
  2027. const onCompanyTemplateChange = function () {
  2028. // 重置这两个字段
  2029. form.value.field5 = '供应商承担'
  2030. form.value.field4 = ''
  2031. if (typeof computedCompany.value.taxReimbursement === 'undefined') {
  2032. form.value.field7 = soOwner.value
  2033. form.value.field8 = '18925020659'
  2034. form.value.field9 = '广州市越秀区八旗二马路广东航运大厦1904室 邮编510110'
  2035. } else {
  2036. // 退税版没有这三个表单项, 直接重置值. 相应的, 非退税版要重新赋值.
  2037. form.value.field7 = ''
  2038. form.value.field8 = ''
  2039. form.value.field9 = ''
  2040. }
  2041. }
  2042. const currentServiceRule = computed(() => {
  2043. if (currentCompany.value === 'PrimePacSoft') {
  2044. return serviceRule.value['PrimePacCommon']
  2045. }
  2046. return serviceRule.value[currentCompany.value as ServiceTypeKeyEnum]
  2047. })
  2048. const currentCompany = ref('PC')
  2049. const computedCompany = computed(() => {
  2050. const result = computedCompanyList.value.filter(
  2051. (i) => i.id === currentCompany.value,
  2052. )
  2053. return result.length ? result[0] : computedCompanyList.value[0]
  2054. })
  2055. // 格式化输出价格的小数位数. 退税版需要显示三位小数, 其他只需要两位小数
  2056. const computedDeci = computed(() => {
  2057. return typeof computedCompany.value.taxReimbursement !== 'undefined' ? 3 : 2
  2058. })
  2059. // 候选 收货地址
  2060. let addressList = ref<ISelectItem[]>([])
  2061. // 候选 运费条款. 目前只有庞吉亚退税版用到, 其他模版默认供应商承担
  2062. let field5_lists = ref<ISelectItem[]>([])
  2063. let supplierPaymentTermsLists = ref<ISelectItem[]>([])
  2064. loading.value = true
  2065. // 获取下拉框非动态候选数据
  2066. const p1 = request
  2067. .post('/common/getfieldsData')
  2068. .then((response: any) => {
  2069. const res = response.data.result
  2070. orderTypeList.value = res.Order_Type_lists.map((i: string) => {
  2071. return {
  2072. label: i,
  2073. }
  2074. }).filter((i: any) => i.label !== '-None-')
  2075. addressList.value = res.field9_lists.map((i: any) => {
  2076. return {
  2077. label: i,
  2078. }
  2079. })
  2080. field5_lists.value = res.field5_lists
  2081. .filter((i: string) => !/^-?[Nn]one-?$/.test(i))
  2082. .map((i: any) => {
  2083. return {
  2084. label: i,
  2085. }
  2086. })
  2087. supplierPaymentTermsLists.value = res.Supplier_Payment_Terms_lists.map(
  2088. (i: any) => {
  2089. return {
  2090. label: i,
  2091. }
  2092. },
  2093. )
  2094. })
  2095. .catch((e) => {
  2096. console.log(e, '下拉框')
  2097. ElMessage.error('获取下拉框数据出错, 请联系管理员.')
  2098. })
  2099. const route = useRoute()
  2100. const soOwner = ref('')
  2101. // 获取销售订单详情
  2102. const p2 = request.post('/common/getSalesOrdersDatV7', { id: route.params.id })
  2103. // 获取对 该so对应客户的标注 并弹窗提醒
  2104. const getAccountsData = async (id: string) =>
  2105. request.post('/common/getAccountsData', { id }).then((response) => {
  2106. const res = response.data
  2107. if (res.code !== 1) return
  2108. if (res.result.User_Notes && res.result.User_Notes.length) {
  2109. ElMessageBox.confirm(res.result.User_Notes, '', {
  2110. confirmButtonText: '将此备注添加到合同',
  2111. cancelButtonText: '已知悉',
  2112. type: 'warning',
  2113. showClose: false,
  2114. closeOnPressEscape: false,
  2115. closeOnClickModal: false,
  2116. autofocus: false,
  2117. })
  2118. .then(() => {
  2119. // 迭代3 需求. 固定填充一行.
  2120. form.value.productList.push(
  2121. Object.assign({}, emptyProductItem, {
  2122. requirement: res.result.User_Notes || '',
  2123. quantity: 1,
  2124. rate: 0,
  2125. id: '4791186000172849436',
  2126. name: 'User Notes',
  2127. CF_Product_Type: '',
  2128. candidate: [
  2129. {
  2130. label: 'User Notes',
  2131. value: '4791186000172849436',
  2132. },
  2133. ],
  2134. }),
  2135. )
  2136. })
  2137. .catch(() => {})
  2138. }
  2139. })
  2140. const getProductData = async (id: string) =>
  2141. request.post('/common/getProductsData', { id }).then((response) => {
  2142. const res = response.data
  2143. if (res.code !== 1) return
  2144. // 推荐供应商. 用来快速选择供应商的.
  2145. if (
  2146. Array.isArray(res.result.SUPPLIER_PRICING) &&
  2147. res.result.SUPPLIER_PRICING.length
  2148. ) {
  2149. for (const item of res.result.SUPPLIER_PRICING) {
  2150. if (
  2151. item.Supplier?.id &&
  2152. !computedRecommandVendorID.value.includes(item.Supplier.id)
  2153. ) {
  2154. console.log(item, 'item')
  2155. recommandVendor.value.push({
  2156. id: item.Supplier.id,
  2157. name: item.Supplier.name,
  2158. })
  2159. }
  2160. }
  2161. }
  2162. return res.result
  2163. })
  2164. const recommandVendor = ref<IRecommandVendor[]>([])
  2165. // 用来去重
  2166. const computedRecommandVendorID = computed(() =>
  2167. recommandVendor.value.map((i: any) => i.id),
  2168. )
  2169. // 根据url传递过来的用户ID获取的用户身份信息
  2170. const userInfo = ref({} as IUser)
  2171. const p3 = request
  2172. .post('/common/getUsersData', { id: route.query.user })
  2173. .then((response) => {
  2174. const res = response.data
  2175. if (res.code !== 1) return
  2176. if (res.result.users && res.result.users.length) {
  2177. userInfo.value = res.result.users[0]
  2178. } else if (res.result.id) {
  2179. userInfo.value = res.result || {}
  2180. } else if (Array.isArray(res.result) && res.result.length) {
  2181. userInfo.value = res.result[0] || {}
  2182. } else {
  2183. ElMessage.error('获取当前用户身份异常, 请联系管理员')
  2184. }
  2185. // 根据用户 ‘组织’ 切换模版默认选中项
  2186. if (userInfo.value.Organization === 'PrimePac') {
  2187. currentCompany.value = 'PrimePacCommon'
  2188. } else {
  2189. currentCompany.value = 'PC'
  2190. }
  2191. })
  2192. const preferSupplier = ref([] as any[])
  2193. Promise.all([p1, p2, p3, getAccountsData])
  2194. .then((array: any[]) => {
  2195. // p2的数据处理逻辑从原本的p2then移动到这里处理.
  2196. // 因为要根据p3用户数据的Organization 来填充产品列表里面的 requirement, 这步处理必须放在p3后面, 而p2 p3是并发操作.
  2197. if (array[1].data.code !== 1) return
  2198. const res = array[1].data.result
  2199. if (res.Account_Name && res.Account_Name.id) {
  2200. getAccountsData(res.Account_Name.id)
  2201. }
  2202. form.value.field7 = res.Owner_name || res.Owner.name || ''
  2203. soOwner.value = res.Owner_name || res.Owner.name || ''
  2204. form.value.Title =
  2205. res.Contract_Title || res.Sales_Order_Title_Job_Name || ''
  2206. form.value.saleOrderId = res.sales_orders_id || res.id || ''
  2207. form.value.PO_Date = dayjs(new Date()).format('YYYY-MM-DD')
  2208. form.value.Reference = res.Reference || ''
  2209. form.value.Artwork_Link = res.Artwork_Link || ''
  2210. let temp = []
  2211. if (res.Ordered_Items) {
  2212. temp = res.Ordered_Items.filter(
  2213. (item: any) => !productBlackList.includes(item.Product_Name.id),
  2214. )
  2215. }
  2216. if (!temp.length) return
  2217. form.value.productList = []
  2218. recommandVendor.value = []
  2219. temp.forEach((item: any) => {
  2220. getProductData(item.Product_Name.id).then((ctx) => {
  2221. console.log(ctx, 'product ctx')
  2222. form.value.productList.push(
  2223. Object.assign({}, emptyProductItem, {
  2224. candidate: [
  2225. {
  2226. Product_Code: item.Product_Name.Product_Code,
  2227. label: item.Product_Name.name,
  2228. value: item.Product_Name.id,
  2229. },
  2230. ],
  2231. Product_Code: item.Product_Name.Product_Code,
  2232. id: item.Product_Name.id,
  2233. name: item.Product_Name.name,
  2234. label: item.Product_Name.name,
  2235. value: item.Product_Name.id,
  2236. desc: item.Description || '',
  2237. quantity: Number(item.Quantity),
  2238. requirement:
  2239. userInfo.value.Organization === 'PrimePac'
  2240. ? '产品名称:\n尺寸:\n材质:\n工艺:\n颜色:\n其他备注:'
  2241. : ctx.CF3 || '',
  2242. CF_Product_Type: ctx.CF_Product_Type,
  2243. SO_Line_Item_Id: item.id,
  2244. }),
  2245. )
  2246. preferSupplier.value.push({
  2247. sku: item.Product_Name.Product_Code || '-',
  2248. list: ctx.Preferred_Supplier.slice() || [],
  2249. })
  2250. })
  2251. })
  2252. })
  2253. .finally(() => {
  2254. loading.value = false
  2255. })
  2256. </script>
  2257. <style lang="scss">
  2258. input[type='number'] {
  2259. -moz-appearance: textfield;
  2260. appearance: textfield;
  2261. &:hover {
  2262. -moz-appearance: textfield;
  2263. appearance: textfield;
  2264. &::-webkit-inner-spin-button,
  2265. &::-webkit-outer-spin-button {
  2266. -webkit-appearance: none;
  2267. margin: 0;
  2268. }
  2269. }
  2270. &::-webkit-inner-spin-button,
  2271. &::-webkit-outer-spin-button {
  2272. -webkit-appearance: none;
  2273. margin: 0;
  2274. }
  2275. }
  2276. .product-select {
  2277. .el-select-dropdown,
  2278. .el-select-dropdown__list {
  2279. min-width: 400px;
  2280. max-width: 500px;
  2281. }
  2282. }
  2283. </style>
  2284. <style lang="scss" scoped>
  2285. @import './style.scss';
  2286. </style>