edit.vue 68 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390
  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 = Array.isArray(response.data.result)
  1312. ? response.data.result[0]
  1313. : response.data.result
  1314. longPONumber.value = res.PO_Number || ''
  1315. PONumber.value = res.Purchase_Order_Number || ''
  1316. resolve(true)
  1317. })
  1318. .catch((e) => {
  1319. reject(e)
  1320. })
  1321. })
  1322. }
  1323. // getPurchaseOrdersData()
  1324. const currencyList = ref([
  1325. {
  1326. label: 'AUD',
  1327. symbol: '',
  1328. country: '',
  1329. },
  1330. {
  1331. label: 'NZD',
  1332. symbol: '',
  1333. country: '',
  1334. },
  1335. {
  1336. label: 'CNY',
  1337. symbol: '¥',
  1338. country: 'CN',
  1339. },
  1340. {
  1341. label: 'GBP',
  1342. symbol: '',
  1343. country: '',
  1344. },
  1345. {
  1346. label: 'EUR',
  1347. symbol: '',
  1348. country: '',
  1349. },
  1350. {
  1351. label: 'USD',
  1352. symbol: '',
  1353. country: '',
  1354. },
  1355. ])
  1356. const currentCurrency = computed(() => {
  1357. const temp = currencyList.value.filter((i) => i.label === form.value.Currency)
  1358. // 2是人民币
  1359. return temp.length ? temp[0] : temp[2]
  1360. })
  1361. let orderTypeList = ref([
  1362. {
  1363. label: '-None-',
  1364. },
  1365. {
  1366. label: '打样',
  1367. },
  1368. {
  1369. label: '大货',
  1370. },
  1371. ])
  1372. const form = ref<IForm>({
  1373. Order_Type: '-None-',
  1374. Artwork_Link: '',
  1375. Currency: 'CNY',
  1376. // 订单号
  1377. saleOrderId: '',
  1378. // 日期
  1379. PO_Date: '',
  1380. // 付款方式
  1381. Payment_Terms: '-None-',
  1382. // 参考, so的job name
  1383. Title: '',
  1384. // 收货地址
  1385. field9: '广州市越秀区八旗二马路广东航运大厦1904室 邮编510110',
  1386. // 收件人
  1387. field7: '',
  1388. // 联系电话
  1389. field8: '18925020659',
  1390. // 工厂交货日期
  1391. field6: '',
  1392. productList: [
  1393. {
  1394. name: '',
  1395. id: '',
  1396. quantity: '',
  1397. rate: '',
  1398. requirement: '',
  1399. desc: '',
  1400. amount: 0,
  1401. discount: '',
  1402. candidate: [],
  1403. },
  1404. ] as IProductItem[],
  1405. // 印刷质量
  1406. field12: '',
  1407. // 产品质量
  1408. field13: '',
  1409. // 质量承诺
  1410. field10: '',
  1411. // 箱子箱唛
  1412. field11: '',
  1413. // 税率
  1414. field4: '0',
  1415. // 运费条款
  1416. field5: '供应商承担',
  1417. currentVendor: '',
  1418. })
  1419. const formRule = ref<FormRules>({
  1420. Artwork_Link: [
  1421. {
  1422. required: true,
  1423. message: '必填项',
  1424. trigger: 'blur',
  1425. },
  1426. ],
  1427. PO_Date: [
  1428. {
  1429. required: true,
  1430. message: '必填项',
  1431. trigger: 'blur',
  1432. },
  1433. ],
  1434. saleOrderId: [
  1435. {
  1436. required: true,
  1437. message: '必填项',
  1438. trigger: 'blur',
  1439. },
  1440. ],
  1441. field7: [
  1442. {
  1443. required: true,
  1444. message: '必填项',
  1445. trigger: 'blur',
  1446. },
  1447. ],
  1448. field8: [
  1449. {
  1450. required: true,
  1451. message: '必填项',
  1452. trigger: 'blur',
  1453. },
  1454. ],
  1455. field6: [
  1456. {
  1457. required: true,
  1458. message: '必填项',
  1459. trigger: 'blur',
  1460. },
  1461. ],
  1462. currentVendor: [
  1463. {
  1464. required: true,
  1465. message: '必填项',
  1466. trigger: 'change',
  1467. },
  1468. ],
  1469. })
  1470. const emptyProductItem = {
  1471. label: '',
  1472. value: '',
  1473. candidate: [],
  1474. name: '',
  1475. desc: '',
  1476. id: '',
  1477. quantity: '',
  1478. rate: '',
  1479. requirement: '',
  1480. // 未计算优惠(discount)之前的总额
  1481. amount: 0,
  1482. // 优惠额度
  1483. discount: '',
  1484. }
  1485. const addRow = function () {
  1486. form.value.productList.push(JSON.parse(JSON.stringify(emptyProductItem)))
  1487. }
  1488. const keyNeedCompute = ['quantity', 'rate']
  1489. const onInputChange = function (e: any, obj: IProductItem, key: string) {
  1490. console.log(e, 'input value before enfore change')
  1491. if (typeof e === 'string') {
  1492. if (e.length) {
  1493. // 强制转换为数字类型
  1494. // obj[key] = Math.round(utils.multiply(Number(e))) / 100
  1495. obj[key] = Math.round(utils.multiply(Number(e), 1000)) / 1000
  1496. // 计算每行的总额
  1497. if (keyNeedCompute.includes(key)) {
  1498. obj.amount = utils.multiply(Number(obj.quantity), Number(obj.rate))
  1499. }
  1500. } else {
  1501. // obj[key] = minValue
  1502. }
  1503. }
  1504. }
  1505. const onProductSelect = function (e: any, product: IProductItem) {
  1506. if (e) {
  1507. const temp = product.candidate.filter((i) => i.value === e)
  1508. if (temp.length) {
  1509. product.name = temp[0].label
  1510. product.Product_Code = temp[0].Product_Code
  1511. }
  1512. } else {
  1513. product.name = ''
  1514. }
  1515. }
  1516. // 小计
  1517. const subTotal = computed(() => {
  1518. return form.value.productList.reduce((total, current) => {
  1519. total = total + Number(current.amount)
  1520. return total
  1521. }, 0)
  1522. })
  1523. // 总优惠额度
  1524. const totalDiscount = computed(() => {
  1525. return form.value.productList.reduce((total, current) => {
  1526. total = total + Number(current.discount)
  1527. return total
  1528. }, 0)
  1529. })
  1530. // 价格统计修正值
  1531. const adjustment = ref(0)
  1532. const formatAdjustment = function (string: string) {
  1533. adjustment.value = Number(string)
  1534. }
  1535. // 总计
  1536. const grandTotal = computed(() => {
  1537. return subTotal.value - totalDiscount.value + adjustment.value
  1538. })
  1539. const productLoading = ref(false)
  1540. const getProductList = utils.debounce(
  1541. (keyword: string, target: IProductItem) => {
  1542. productLoading.value = true
  1543. const data = {
  1544. value: keyword.trim(),
  1545. name: 'Products',
  1546. api_name: 'Product_Name',
  1547. contains: 'contains',
  1548. page: 1,
  1549. limit: 200,
  1550. }
  1551. getSearchData(data)
  1552. .then((response) => {
  1553. if (response.data.code !== 1) return
  1554. const res = response.data.result
  1555. target.candidate = res.data.map((item: any) => {
  1556. return {
  1557. ...item,
  1558. label: item.Product_Name,
  1559. value: item.products_id || item.id,
  1560. }
  1561. })
  1562. })
  1563. .finally(() => {
  1564. productLoading.value = false
  1565. })
  1566. },
  1567. 1000,
  1568. )
  1569. const vendorList = ref<IVendorItem[]>([])
  1570. const computedVendor = computed(() => {
  1571. const temp = vendorList.value.filter(
  1572. (i) => i.value === form.value.currentVendor,
  1573. )
  1574. return temp.length
  1575. ? temp[0]
  1576. : {
  1577. Primary_Contact_name: '',
  1578. PDF_display: '',
  1579. label: '',
  1580. value: '',
  1581. }
  1582. })
  1583. const vendorLoading = ref(false)
  1584. const getSupplierLists = utils.debounce(function (string: string) {
  1585. const data = {
  1586. value: string.trim(),
  1587. name: 'Vendors',
  1588. api_name: 'Vendor_Name',
  1589. contains: 'contains',
  1590. page: 1,
  1591. limit: 200,
  1592. }
  1593. vendorLoading.value = true
  1594. getSearchData(data)
  1595. .then((response) => {
  1596. if (response.data.code !== 1) return
  1597. const res = response.data.result
  1598. vendorList.value = res.data.map((i: any) => {
  1599. return {
  1600. ...i,
  1601. label: i.Suppliers_Name || i.Vendor_Name,
  1602. value: i.supplier_id || i.id,
  1603. Primary_Contact_name: i.Primary_Contact_name || '',
  1604. PDF_display: i.PDF_display || '',
  1605. }
  1606. })
  1607. })
  1608. .finally(() => {
  1609. vendorLoading.value = false
  1610. })
  1611. }, 1000)
  1612. getSupplierLists('')
  1613. const getSearchData = async function (p: any) {
  1614. return await axios
  1615. .post('/api/common/getPublicLists', p, {
  1616. headers: { 'Content-Type': 'multipart/form-data' },
  1617. })
  1618. .then((response) => {
  1619. return response
  1620. })
  1621. }
  1622. const getPath = function (path: string) {
  1623. return new URL(path, import.meta.url).href
  1624. }
  1625. // 用于切换合同模版
  1626. const companyList = ref<ICompanyItem[]>([
  1627. {
  1628. id: 'PC',
  1629. label: 'PC',
  1630. name: '澳之原贸易有限公司',
  1631. addr: 'UNIT 12,21/F WAYSON COMM BLDG NO 28 CONNAUGHT RD WEST SHEUNG WAN,HK',
  1632. phone: '020-81609790',
  1633. signPath: getPath('/assets/sign/AZY.png'),
  1634. },
  1635. {
  1636. id: 'Pangea',
  1637. label: 'Pangea',
  1638. name: '庞吉亚国际商务服务(广州)有限公司',
  1639. addr: '广州市越秀区八旗二马路48号内自编1号主楼自编1605、1606房',
  1640. phone: '020-81609790',
  1641. fax: '020-81519492',
  1642. signPath: getPath('/assets/sign/Pangea.png'),
  1643. },
  1644. {
  1645. id: 'PangeaTaxReimbursement',
  1646. label: 'Pangea_退税版',
  1647. name: '庞吉亚国际商务服务(广州)有限公司',
  1648. addr: '广州市越秀区八旗二马路48号内自编1号主楼自编1605、1606房',
  1649. phone: '020-81609790',
  1650. fax: '020-81519492',
  1651. // 名字叫退税版, 实际上合同没有第二份pdf. 判断是否退税版的依据是键名存在与否, 而不是这个值的真假
  1652. taxReimbursement: false,
  1653. signPath: getPath('/assets/sign/Pangea.png'),
  1654. },
  1655. {
  1656. id: 'AZYTaxReimbursement',
  1657. label: 'AZY_退税版',
  1658. name: '澳之原贸易有限公司',
  1659. addr: 'UNIT 12,21/F WAYSON COMM BLDG NO 28 CONNAUGHT RD WEST SHEUNG WAN,HK',
  1660. phone: '020-81609790',
  1661. taxReimbursement: true,
  1662. signPath: getPath('/assets/sign/AZY.png'),
  1663. },
  1664. {
  1665. id: 'FOTTaxReimbursement',
  1666. label: 'FOT_退税版',
  1667. name: 'FAIR OCEAN TRADING AUSTRALIA PTY.LTD',
  1668. addr: '15/10 Chilvers Road, Thornleigh, NSW 2120',
  1669. phone: '020-81609790',
  1670. taxReimbursement: true,
  1671. signPath: getPath('/assets/sign/FOT.png'),
  1672. },
  1673. ])
  1674. // 切换模版后的处理
  1675. const onCompanyTemplateChange = function () {
  1676. // 重置这两个字段
  1677. form.value.field5 = '供应商承担'
  1678. form.value.field4 = ''
  1679. if (typeof computedCompany.value.taxReimbursement === 'undefined') {
  1680. form.value.field7 = soOwner.value
  1681. form.value.field8 = '18925020659'
  1682. form.value.field9 = '广州市越秀区八旗二马路广东航运大厦1904室 邮编510110'
  1683. } else {
  1684. // 退税版没有这三个表单项, 直接重置值. 相应的, 非退税版要重新赋值.
  1685. form.value.field7 = ''
  1686. form.value.field8 = ''
  1687. form.value.field9 = ''
  1688. }
  1689. }
  1690. // 合同的服务条款
  1691. const serviceRule = ref<TypeService>({
  1692. PC: [
  1693. '一、本采购订单签署原件一式两份,双方各持一份。',
  1694. '二、验收标准:按乙方所寄样板及国家出口标准作为验收标准。',
  1695. '三、交货期限:交货期限必须严格执行。',
  1696. '四、交货地点:甲方广州公司地址,如上收货地址。',
  1697. '五、付款方式:甲方通过银行转帐的方式付款,乙方账户信息如上。',
  1698. '六、如因未能按上述标准及期限交货而产生经济损失,将由乙方承担。',
  1699. '七、凡因执行本合同所发生的或与本合同有关的一切争议,如经友好协商不能解决时,交由广州当地法院进行判决。',
  1700. ],
  1701. Pangea: [
  1702. '一、本采购订单签署原件一式两份,双方各持一份。',
  1703. '二、验收标准:按乙方所寄样板及国家出口标准作为验收标准。',
  1704. '三、交货期限:交货期限必须严格执行。',
  1705. '四、交货地点:甲方广州公司地址,如上收货地址。',
  1706. '五、付款方式:甲方通过银行转帐的方式付款,乙方账户信息如上。',
  1707. '六、如因未能按上述标准及期限交货而产生经济损失,将由乙方承担。',
  1708. '七、凡因执行本合同所发生的或与本合同有关的一切争议,如经友好协商不能解决时,交由广州当地法院进行判决。',
  1709. ],
  1710. PangeaTaxReimbursement: [
  1711. '三、本采购订单签署原件一式两份,双方各持一份。',
  1712. '四、验收标准:按乙方所寄样板及国家出口标准作为验收标准。',
  1713. '五、交货期限:交货期限必须严格执行。',
  1714. '六、交货地点: 广州市越秀区八旗二马路48号航运大厦1605、1606房',
  1715. '七、付款方式:甲方通过银行转帐的方式付款,乙方账户信息如上。',
  1716. '八、如因未能按上述标准及期限交货而产生经济损失,将由乙方承担。',
  1717. '九、凡因执行本合同所发生的或与本合同有关的一切争议,如经友好协商不能解决时,交由广州当地法院进行判决。',
  1718. '十、我司开票资料:',
  1719. '账户名称:庞吉亚国际商务服务(广州)有限公司',
  1720. '统一社会代码:91440101MA9XUQNB4B',
  1721. '公司地址:广州市越秀区八旗二马路48号内自编1号主楼16楼自编1605、1606房 ',
  1722. '公司电话:81609790',
  1723. '基本账户:中国光大银行股份有限公司广州分行越秀支行',
  1724. '账户号码:77910180803936888',
  1725. '开户银行地址:广州市越秀区文德南路69号',
  1726. ],
  1727. AZYTaxReimbursement: [
  1728. '一、本采购订单签署原件一式两份,双方各持一份。',
  1729. '二、验收标准:按乙方所寄样板及国家出口标准作为验收标准。',
  1730. '三、交货期限:交货期限必须严格执行。',
  1731. '四、收货地址:澳竣元代收,广州市越秀区八旗二马路48号航运大厦1902房。',
  1732. '五、付款方式:甲方通过银行转帐的方式付款,乙方账户信息如上。',
  1733. '六、如因未能按上述标准及期限交货而产生经济损失,将由乙方承担。',
  1734. '七、凡因执行本合同所发生的或与本合同有关的一切争议,如经友好协商不能解决时,交由广州当地法院进行判决。',
  1735. ],
  1736. FOTTaxReimbursement: [
  1737. '一、本采购订单签署原件一式两份,双方各持一份。',
  1738. '二、验收标准:按乙方所寄样板及国家出口标准作为验收标准。',
  1739. '三、交货期限:交货期限必须严格执行。',
  1740. '四、收货地址:澳竣元代收,广州市越秀区八旗二马路48号航运大厦1902房。',
  1741. '五、付款方式:甲方通过银行转帐的方式付款,乙方账户信息如上。',
  1742. '六、如因未能按上述标准及期限交货而产生经济损失,将由乙方承担。',
  1743. '七、凡因执行本合同所发生的或与本合同有关的一切争议,如经友好协商不能解决时,交由广州当地法院进行判决。',
  1744. ],
  1745. })
  1746. const currentServiceRule = computed(() => {
  1747. return serviceRule.value[currentCompany.value as ServiceTypeKeyEnum]
  1748. })
  1749. const currentCompany = ref('PC')
  1750. const computedCompany = computed(() => {
  1751. const result = companyList.value.filter((i) => i.id === currentCompany.value)
  1752. return result.length ? result[0] : companyList.value[0]
  1753. })
  1754. // 格式化输出价格的小数位数. 退税版需要显示三位小数, 其他只需要两位小数
  1755. const computedDeci = computed(() => {
  1756. return typeof computedCompany.value.taxReimbursement !== 'undefined' ? 3 : 2
  1757. })
  1758. // 候选 收货地址
  1759. let addressList = ref<ISelectItem[]>([])
  1760. // 候选 运费条款. 目前只有庞吉亚退税版用到, 其他模版默认供应商承担
  1761. let field5_lists = ref<ISelectItem[]>([])
  1762. let supplierPaymentTermsLists = ref<ISelectItem[]>([])
  1763. // 获取下拉框非动态候选数据
  1764. axios
  1765. .post('/api/common/getfieldsData')
  1766. .then((response: any) => {
  1767. // console.log(response, '/common/getfieldsData')
  1768. const res = response.data.result
  1769. orderTypeList.value = res.Order_Type_lists.map((i: any) => {
  1770. return {
  1771. label: i,
  1772. }
  1773. })
  1774. addressList.value = res.field9_lists.map((i: any) => {
  1775. return {
  1776. label: i,
  1777. }
  1778. })
  1779. field5_lists.value = res.field5_lists
  1780. .filter((i: string) => !/^-?[Nn]one-?$/.test(i))
  1781. .map((i: any) => {
  1782. return {
  1783. label: i,
  1784. }
  1785. })
  1786. supplierPaymentTermsLists.value = res.Supplier_Payment_Terms_lists.map(
  1787. (i: any) => {
  1788. return {
  1789. label: i,
  1790. }
  1791. },
  1792. )
  1793. })
  1794. .catch((e) => {
  1795. console.log(e, '下拉框')
  1796. ElMessage.error('获取下拉框数据出错, 请联系管理员.')
  1797. })
  1798. const route = useRoute()
  1799. const productBlackList = ['4791186000046982872', '4791186000046982896']
  1800. const soOwner = ref('')
  1801. // 获取销售订单详情
  1802. axios
  1803. .post('/api/common/getSalesOrdersData', { id: route.params.id })
  1804. .then((response) => {
  1805. if (response.data.code !== 1) return
  1806. const res = response.data.result
  1807. form.value.field7 = res.Owner_name || res.Owner.name || ''
  1808. soOwner.value = res.Owner_name || res.Owner.name || ''
  1809. form.value.Title = res.Sales_Order_Title_Job_Name || ''
  1810. form.value.saleOrderId = res.sales_orders_id || res.id || ''
  1811. form.value.PO_Date = dayjs(new Date()).format('YYYY-MM-DD')
  1812. let temp = []
  1813. if (res.details) {
  1814. temp = res.details.filter(
  1815. (item: any) => !productBlackList.includes(item.product_id),
  1816. )
  1817. } else if (res.Product_Details) {
  1818. temp = res.Product_Details.filter(
  1819. (item: any) => !productBlackList.includes(item.product.id),
  1820. )
  1821. }
  1822. if (!temp.length) return
  1823. form.value.productList = []
  1824. temp.forEach((item: any) => {
  1825. form.value.productList.push(
  1826. Object.assign({}, emptyProductItem, {
  1827. candidate: [
  1828. {
  1829. Product_Code: item.product_Product_Code,
  1830. label: item.product.name,
  1831. value: item.product.id,
  1832. },
  1833. ],
  1834. Product_Code: item.product.Product_Code,
  1835. id: item.product.id,
  1836. name: item.product.name,
  1837. label: item.product.name,
  1838. value: item.product.id,
  1839. desc: item.product_description || '',
  1840. quantity: Number(item.quantity),
  1841. }),
  1842. )
  1843. })
  1844. })
  1845. // 根据url传递过来的用户ID获取的用户身份信息
  1846. const userInfo = ref({} as IUser)
  1847. axios
  1848. .post('/api/common/getUsersData', { id: route.query.user })
  1849. .then((response) => {
  1850. const res = response.data
  1851. if (res.code !== 1) return
  1852. userInfo.value = res.result || {}
  1853. })
  1854. </script>
  1855. <style lang="scss" scoped>
  1856. .view-window {
  1857. height: 100vh;
  1858. width: 100vw;
  1859. position: fixed;
  1860. z-index: 999;
  1861. background-color: rgba(#fff, 0.3);
  1862. left: 0;
  1863. top: 0;
  1864. }
  1865. .screen {
  1866. margin: 0 auto;
  1867. font-size: 12pt;
  1868. line-height: 22pt;
  1869. }
  1870. .page-title-wrap {
  1871. padding: 12px 36px;
  1872. border-bottom: 1px solid #eee;
  1873. margin-bottom: 24px;
  1874. }
  1875. .page-title {
  1876. font-size: 36px;
  1877. margin-left: 8px;
  1878. }
  1879. .layout-left {
  1880. width: 435px;
  1881. min-width: 435px;
  1882. padding-right: 24px;
  1883. }
  1884. .layout-right {
  1885. position: relative;
  1886. border-left: 1px solid #eee;
  1887. padding: 0 24px;
  1888. }
  1889. .rule-item {
  1890. .el-form-item {
  1891. margin-bottom: 0;
  1892. }
  1893. }
  1894. .sign-wrap {
  1895. width: 100pt;
  1896. &.pangea {
  1897. width: 180pt;
  1898. }
  1899. img {
  1900. width: 100%;
  1901. }
  1902. }
  1903. .screen {
  1904. max-width: 1600px;
  1905. margin: 0 auto;
  1906. .company-info {
  1907. text-align: center;
  1908. font-size: 10pt;
  1909. color: $subColor;
  1910. margin-bottom: 16pt;
  1911. }
  1912. .company-name {
  1913. margin-bottom: 4pt;
  1914. color: $mainColor;
  1915. font-size: 16pt;
  1916. line-height: 22pt;
  1917. }
  1918. .company-addr {
  1919. line-height: 12pt;
  1920. height: 12pt;
  1921. }
  1922. .company-phone {
  1923. line-height: 12pt;
  1924. height: 12pt;
  1925. }
  1926. .company-fax {
  1927. line-height: 12pt;
  1928. height: 12pt;
  1929. }
  1930. .form-area {
  1931. position: relative;
  1932. }
  1933. .form-area-left {
  1934. width: 30%;
  1935. }
  1936. .form-area-right {
  1937. width: 45%;
  1938. position: relative;
  1939. text-align: right;
  1940. vertical-align: top;
  1941. .label {
  1942. display: inline-block;
  1943. width: 40%;
  1944. vertical-align: top;
  1945. }
  1946. .value {
  1947. width: 60%;
  1948. word-break: break-word;
  1949. display: inline-block;
  1950. }
  1951. }
  1952. .product-table-separator {
  1953. width: 95%;
  1954. }
  1955. .product-total-table {
  1956. display: inline-block;
  1957. border: 1px solid #eee;
  1958. min-width: 220pt;
  1959. border-radius: 8pt;
  1960. position: relative;
  1961. right: 0;
  1962. top: 0;
  1963. .total-item {
  1964. & > div {
  1965. display: inline-block;
  1966. height: 26pt;
  1967. line-height: 26pt;
  1968. padding: 0 8pt;
  1969. }
  1970. &:nth-of-type(n + 1) {
  1971. border-top: 1px solid #eee;
  1972. }
  1973. }
  1974. .label {
  1975. width: 50%;
  1976. text-align: right;
  1977. }
  1978. .value {
  1979. width: 50%;
  1980. text-align: left;
  1981. }
  1982. }
  1983. .product-table {
  1984. table {
  1985. border: 1pt solid #eee;
  1986. width: 100%;
  1987. }
  1988. tr:nth-of-type(n + 3) td {
  1989. border-top: 1pt solid #eee;
  1990. }
  1991. th {
  1992. text-align: center;
  1993. background-color: $tableHeaderBgColor;
  1994. }
  1995. td {
  1996. padding: 8pt 8pt 4pt;
  1997. min-width: 30pt;
  1998. max-width: 100pt;
  1999. }
  2000. th + th,
  2001. td + td {
  2002. border-left: 1pt solid #eee;
  2003. }
  2004. .action {
  2005. text-align: center;
  2006. width: 50pt;
  2007. }
  2008. .quantity,
  2009. .rate,
  2010. .amount,
  2011. .discount {
  2012. width: 80pt;
  2013. }
  2014. .requirement {
  2015. width: 180pt;
  2016. }
  2017. .product {
  2018. width: 180pt;
  2019. }
  2020. }
  2021. .note-form-area {
  2022. width: 40%;
  2023. }
  2024. .rule-item {
  2025. color: $subColor;
  2026. line-height: 26pt;
  2027. }
  2028. .sub-form-title {
  2029. padding-left: 4pt;
  2030. border-left: 2pt solid #efefef;
  2031. margin-bottom: 8pt;
  2032. }
  2033. }
  2034. .preview-area {
  2035. font-size: 10pt;
  2036. line-height: 22pt;
  2037. color: $mainColor;
  2038. box-sizing: border-box;
  2039. * {
  2040. padding: 0;
  2041. margin: 0;
  2042. }
  2043. .company-info {
  2044. text-align: center;
  2045. font-size: 9pt;
  2046. color: $subColor;
  2047. margin-bottom: 16pt;
  2048. }
  2049. .company-name {
  2050. margin-bottom: 4pt;
  2051. color: $mainColor;
  2052. font-size: 16pt;
  2053. line-height: 22pt;
  2054. }
  2055. .company-addr {
  2056. line-height: 12pt;
  2057. height: 12pt;
  2058. }
  2059. .company-phone {
  2060. line-height: 12pt;
  2061. height: 12pt;
  2062. }
  2063. .company-fax {
  2064. line-height: 12pt;
  2065. height: 12pt;
  2066. }
  2067. $titleWidth: 100%;
  2068. .pdf-title {
  2069. text-align: center;
  2070. font-size: 28pt;
  2071. line-height: 36pt;
  2072. height: 36pt;
  2073. width: $titleWidth;
  2074. margin: 0 auto;
  2075. background-color: #fff;
  2076. }
  2077. .pdf-title-bg {
  2078. width: 100%;
  2079. height: 2pt;
  2080. .center {
  2081. width: 33%;
  2082. text-align: center;
  2083. }
  2084. .right,
  2085. .left {
  2086. width: 33%;
  2087. height: 3pt;
  2088. line-height: 3pt;
  2089. & > div {
  2090. width: 100%;
  2091. height: 2pt;
  2092. line-height: 2pt;
  2093. background-color: $bgColor;
  2094. }
  2095. }
  2096. }
  2097. .form-area {
  2098. padding-top: 24pt;
  2099. line-height: 14pt;
  2100. $formAreaFontSize: 10pt;
  2101. white-space: pre-wrap;
  2102. font-size: $formAreaFontSize;
  2103. & > .flex-auto {
  2104. width: 50%;
  2105. & > div {
  2106. padding-bottom: 8pt;
  2107. }
  2108. }
  2109. .column-vendor {
  2110. vertical-align: top;
  2111. }
  2112. .column-form-label {
  2113. width: 40%;
  2114. }
  2115. .column-form-value {
  2116. width: 60%;
  2117. }
  2118. }
  2119. .product-table-separator {
  2120. width: 100%;
  2121. margin: 15pt auto 10pt;
  2122. height: 2pt;
  2123. background-color: $bgColor;
  2124. }
  2125. .product-table {
  2126. table {
  2127. margin: 0 auto 6pt;
  2128. width: 100%;
  2129. border-radius: 6pt;
  2130. text-align: left;
  2131. }
  2132. tr:nth-of-type(n + 1) td {
  2133. border-top: 1pt solid #eee;
  2134. }
  2135. th {
  2136. background-color: $bgColor;
  2137. min-width: 20pt;
  2138. padding: 0 2pt;
  2139. }
  2140. td {
  2141. min-width: 20pt;
  2142. max-width: 100pt;
  2143. padding: 0 2pt;
  2144. .desc {
  2145. white-space: pre-wrap;
  2146. line-height: 16pt;
  2147. color: $subColor;
  2148. }
  2149. }
  2150. .row-index {
  2151. width: 20pt;
  2152. }
  2153. }
  2154. .note-form-area {
  2155. width: 40%;
  2156. .label {
  2157. color: $subColor;
  2158. display: inline-block;
  2159. width: 40%;
  2160. vertical-align: top;
  2161. }
  2162. .value {
  2163. color: $subColor;
  2164. width: 60%;
  2165. word-break: break-word;
  2166. white-space: pre-wrap;
  2167. display: inline-block;
  2168. line-height: 16pt;
  2169. }
  2170. }
  2171. .sub-form-title {
  2172. color: $subColor;
  2173. font-weight: bold;
  2174. }
  2175. .rule-item {
  2176. color: $subColor;
  2177. line-height: 26pt;
  2178. }
  2179. .signature-area {
  2180. color: $subColor;
  2181. .first-party {
  2182. padding: 30pt 0 0;
  2183. }
  2184. .second-party {
  2185. padding: 20pt 0 40pt;
  2186. }
  2187. }
  2188. }
  2189. .preview-area2 {
  2190. .supplier-name {
  2191. font-size: 22pt;
  2192. text-align: center;
  2193. }
  2194. .billing-addr {
  2195. line-height: 18pt;
  2196. min-height: 18pt;
  2197. font-size: 12pt;
  2198. text-align: center;
  2199. }
  2200. .contact-info {
  2201. margin-bottom: 12pt;
  2202. min-height: 18pt;
  2203. line-height: 18pt;
  2204. font-size: 12pt;
  2205. }
  2206. .product-table {
  2207. table {
  2208. border: 1px solid $bgColor;
  2209. border-radius: 3pt;
  2210. margin: 0 auto 6pt;
  2211. width: 100%;
  2212. font-size: 10pt;
  2213. }
  2214. th {
  2215. text-align: left;
  2216. }
  2217. td {
  2218. white-space: pre-wrap;
  2219. }
  2220. th,
  2221. td {
  2222. padding: 4pt 6pt;
  2223. &:nth-of-type(n + 2) {
  2224. border-left: 1px solid $bgColor;
  2225. }
  2226. }
  2227. tr:nth-of-type(n + 2) {
  2228. td {
  2229. border-top: 1px solid $bgColor;
  2230. }
  2231. }
  2232. }
  2233. .table-title {
  2234. text-align: center;
  2235. font-weight: bold;
  2236. font-size: 16pt;
  2237. margin: 12pt auto 8pt;
  2238. }
  2239. .base-info-area {
  2240. margin-top: 12pt;
  2241. font-size: 11pt;
  2242. .base-info-label {
  2243. min-width: 90pt;
  2244. width: 90pt;
  2245. font-family: serif;
  2246. }
  2247. .base-info-value {
  2248. white-space: pre-wrap;
  2249. vertical-align: top;
  2250. flex: auto;
  2251. text-align: left;
  2252. font-family: sans-serif;
  2253. font-weight: 400;
  2254. }
  2255. .left {
  2256. padding-right: 8pt;
  2257. .base-info-label {
  2258. min-width: 60pt;
  2259. width: 60pt;
  2260. }
  2261. }
  2262. .right {
  2263. padding-left: 8pt;
  2264. }
  2265. .left,
  2266. .right {
  2267. width: 50%;
  2268. margin-bottom: 12pt;
  2269. }
  2270. }
  2271. .bank-info-area {
  2272. font-family: sans-serif;
  2273. font-weight: bold;
  2274. font-size: 11pt;
  2275. margin-bottom: 10pt;
  2276. .bank-info-label {
  2277. font-weight: bold;
  2278. font-family: serif;
  2279. width: 160pt;
  2280. max-width: 160pt;
  2281. }
  2282. .bank-info-value {
  2283. font-family: serif;
  2284. font-weight: normal;
  2285. }
  2286. }
  2287. }
  2288. @media print {
  2289. .screen {
  2290. display: none;
  2291. }
  2292. .preview-area,
  2293. .preview-area2 {
  2294. border: none;
  2295. border-color: transparent;
  2296. }
  2297. }
  2298. @media screen {
  2299. .print.hidden {
  2300. position: fixed;
  2301. right: -10000px;
  2302. bottom: -10000px;
  2303. }
  2304. .pdf-wrap {
  2305. position: relative;
  2306. width: 21cm;
  2307. min-height: 29.69cm;
  2308. margin: 20px auto;
  2309. box-shadow: 1px 1px 2pt 0px $subColor;
  2310. }
  2311. .preview-area,
  2312. .preview-area2 {
  2313. padding: 1cm;
  2314. }
  2315. }
  2316. </style>