edit.vue 68 KB

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