edit.vue 68 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388
  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
  1613. .post('/api/common/getPublicLists', p, {
  1614. headers: { 'Content-Type': 'multipart/form-data' },
  1615. })
  1616. .then((response) => {
  1617. return response
  1618. })
  1619. }
  1620. const getPath = function (path: string) {
  1621. return new URL(path, import.meta.url).href
  1622. }
  1623. // 用于切换合同模版
  1624. const companyList = ref<ICompanyItem[]>([
  1625. {
  1626. id: 'PC',
  1627. label: 'PC',
  1628. name: '澳之原贸易有限公司',
  1629. addr: 'UNIT 12,21/F WAYSON COMM BLDG NO 28 CONNAUGHT RD WEST SHEUNG WAN,HK',
  1630. phone: '020-81609790',
  1631. signPath: getPath('/assets/sign/AZY.png'),
  1632. },
  1633. {
  1634. id: 'Pangea',
  1635. label: 'Pangea',
  1636. name: '庞吉亚国际商务服务(广州)有限公司',
  1637. addr: '广州市越秀区八旗二马路48号内自编1号主楼自编1605、1606房',
  1638. phone: '020-81609790',
  1639. fax: '020-81519492',
  1640. signPath: getPath('/assets/sign/Pangea.png'),
  1641. },
  1642. {
  1643. id: 'PangeaTaxReimbursement',
  1644. label: 'Pangea_退税版',
  1645. name: '庞吉亚国际商务服务(广州)有限公司',
  1646. addr: '广州市越秀区八旗二马路48号内自编1号主楼自编1605、1606房',
  1647. phone: '020-81609790',
  1648. fax: '020-81519492',
  1649. // 名字叫退税版, 实际上合同没有第二份pdf. 判断是否退税版的依据是键名存在与否, 而不是这个值的真假
  1650. taxReimbursement: false,
  1651. signPath: getPath('/assets/sign/Pangea.png'),
  1652. },
  1653. {
  1654. id: 'AZYTaxReimbursement',
  1655. label: 'AZY_退税版',
  1656. name: '澳之原贸易有限公司',
  1657. addr: 'UNIT 12,21/F WAYSON COMM BLDG NO 28 CONNAUGHT RD WEST SHEUNG WAN,HK',
  1658. phone: '020-81609790',
  1659. taxReimbursement: true,
  1660. signPath: getPath('/assets/sign/AZY.png'),
  1661. },
  1662. {
  1663. id: 'FOTTaxReimbursement',
  1664. label: 'FOT_退税版',
  1665. name: 'FAIR OCEAN TRADING AUSTRALIA PTY.LTD',
  1666. addr: '15/10 Chilvers Road, Thornleigh, NSW 2120',
  1667. phone: '020-81609790',
  1668. taxReimbursement: true,
  1669. signPath: getPath('/assets/sign/FOT.png'),
  1670. },
  1671. ])
  1672. // 切换模版后的处理
  1673. const onCompanyTemplateChange = function () {
  1674. // 重置这两个字段
  1675. form.value.field5 = '供应商承担'
  1676. form.value.field4 = ''
  1677. if (typeof computedCompany.value.taxReimbursement === 'undefined') {
  1678. form.value.field7 = soOwner.value
  1679. form.value.field8 = '18925020659'
  1680. form.value.field9 = '广州市越秀区八旗二马路广东航运大厦1904室 邮编510110'
  1681. } else {
  1682. // 退税版没有这三个表单项, 直接重置值. 相应的, 非退税版要重新赋值.
  1683. form.value.field7 = ''
  1684. form.value.field8 = ''
  1685. form.value.field9 = ''
  1686. }
  1687. }
  1688. // 合同的服务条款
  1689. const serviceRule = ref<TypeService>({
  1690. PC: [
  1691. '一、本采购订单签署原件一式两份,双方各持一份。',
  1692. '二、验收标准:按乙方所寄样板及国家出口标准作为验收标准。',
  1693. '三、交货期限:交货期限必须严格执行。',
  1694. '四、交货地点:甲方广州公司地址,如上收货地址。',
  1695. '五、付款方式:甲方通过银行转帐的方式付款,乙方账户信息如上。',
  1696. '六、如因未能按上述标准及期限交货而产生经济损失,将由乙方承担。',
  1697. '七、凡因执行本合同所发生的或与本合同有关的一切争议,如经友好协商不能解决时,交由广州当地法院进行判决。',
  1698. ],
  1699. Pangea: [
  1700. '一、本采购订单签署原件一式两份,双方各持一份。',
  1701. '二、验收标准:按乙方所寄样板及国家出口标准作为验收标准。',
  1702. '三、交货期限:交货期限必须严格执行。',
  1703. '四、交货地点:甲方广州公司地址,如上收货地址。',
  1704. '五、付款方式:甲方通过银行转帐的方式付款,乙方账户信息如上。',
  1705. '六、如因未能按上述标准及期限交货而产生经济损失,将由乙方承担。',
  1706. '七、凡因执行本合同所发生的或与本合同有关的一切争议,如经友好协商不能解决时,交由广州当地法院进行判决。',
  1707. ],
  1708. PangeaTaxReimbursement: [
  1709. '三、本采购订单签署原件一式两份,双方各持一份。',
  1710. '四、验收标准:按乙方所寄样板及国家出口标准作为验收标准。',
  1711. '五、交货期限:交货期限必须严格执行。',
  1712. '六、交货地点: 广州市越秀区八旗二马路48号航运大厦1605、1606房',
  1713. '七、付款方式:甲方通过银行转帐的方式付款,乙方账户信息如上。',
  1714. '八、如因未能按上述标准及期限交货而产生经济损失,将由乙方承担。',
  1715. '九、凡因执行本合同所发生的或与本合同有关的一切争议,如经友好协商不能解决时,交由广州当地法院进行判决。',
  1716. '十、我司开票资料:',
  1717. '账户名称:庞吉亚国际商务服务(广州)有限公司',
  1718. '统一社会代码:91440101MA9XUQNB4B',
  1719. '公司地址:广州市越秀区八旗二马路48号内自编1号主楼16楼自编1605、1606房 ',
  1720. '公司电话:81609790',
  1721. '基本账户:中国光大银行股份有限公司广州分行越秀支行',
  1722. '账户号码:77910180803936888',
  1723. '开户银行地址:广州市越秀区文德南路69号',
  1724. ],
  1725. AZYTaxReimbursement: [
  1726. '一、本采购订单签署原件一式两份,双方各持一份。',
  1727. '二、验收标准:按乙方所寄样板及国家出口标准作为验收标准。',
  1728. '三、交货期限:交货期限必须严格执行。',
  1729. '四、收货地址:澳竣元代收,广州市越秀区八旗二马路48号航运大厦1902房。',
  1730. '五、付款方式:甲方通过银行转帐的方式付款,乙方账户信息如上。',
  1731. '六、如因未能按上述标准及期限交货而产生经济损失,将由乙方承担。',
  1732. '七、凡因执行本合同所发生的或与本合同有关的一切争议,如经友好协商不能解决时,交由广州当地法院进行判决。',
  1733. ],
  1734. FOTTaxReimbursement: [
  1735. '一、本采购订单签署原件一式两份,双方各持一份。',
  1736. '二、验收标准:按乙方所寄样板及国家出口标准作为验收标准。',
  1737. '三、交货期限:交货期限必须严格执行。',
  1738. '四、收货地址:澳竣元代收,广州市越秀区八旗二马路48号航运大厦1902房。',
  1739. '五、付款方式:甲方通过银行转帐的方式付款,乙方账户信息如上。',
  1740. '六、如因未能按上述标准及期限交货而产生经济损失,将由乙方承担。',
  1741. '七、凡因执行本合同所发生的或与本合同有关的一切争议,如经友好协商不能解决时,交由广州当地法院进行判决。',
  1742. ],
  1743. })
  1744. const currentServiceRule = computed(() => {
  1745. return serviceRule.value[currentCompany.value as ServiceTypeKeyEnum]
  1746. })
  1747. const currentCompany = ref('PC')
  1748. const computedCompany = computed(() => {
  1749. const result = companyList.value.filter((i) => i.id === currentCompany.value)
  1750. return result.length ? result[0] : companyList.value[0]
  1751. })
  1752. // 格式化输出价格的小数位数. 退税版需要显示三位小数, 其他只需要两位小数
  1753. const computedDeci = computed(() => {
  1754. return typeof computedCompany.value.taxReimbursement !== 'undefined' ? 3 : 2
  1755. })
  1756. // 候选 收货地址
  1757. let addressList = ref<ISelectItem[]>([])
  1758. // 候选 运费条款. 目前只有庞吉亚退税版用到, 其他模版默认供应商承担
  1759. let field5_lists = ref<ISelectItem[]>([])
  1760. let supplierPaymentTermsLists = ref<ISelectItem[]>([])
  1761. // 获取下拉框非动态候选数据
  1762. axios
  1763. .post('/api/common/getfieldsData')
  1764. .then((response: any) => {
  1765. // console.log(response, '/common/getfieldsData')
  1766. const res = response.data.result
  1767. orderTypeList.value = res.Order_Type_lists.map((i: any) => {
  1768. return {
  1769. label: i,
  1770. }
  1771. })
  1772. addressList.value = res.field9_lists.map((i: any) => {
  1773. return {
  1774. label: i,
  1775. }
  1776. })
  1777. field5_lists.value = res.field5_lists
  1778. .filter((i: string) => !/^-?[Nn]one-?$/.test(i))
  1779. .map((i: any) => {
  1780. return {
  1781. label: i,
  1782. }
  1783. })
  1784. supplierPaymentTermsLists.value = res.Supplier_Payment_Terms_lists.map(
  1785. (i: any) => {
  1786. return {
  1787. label: i,
  1788. }
  1789. },
  1790. )
  1791. })
  1792. .catch((e) => {
  1793. console.log(e, '下拉框')
  1794. ElMessage.error('获取下拉框数据出错, 请联系管理员.')
  1795. })
  1796. const route = useRoute()
  1797. const productBlackList = ['4791186000046982872', '4791186000046982896']
  1798. const soOwner = ref('')
  1799. // 获取销售订单详情
  1800. axios
  1801. .post('/api/common/getSalesOrdersData', { id: route.params.id })
  1802. .then((response) => {
  1803. if (response.data.code !== 1) return
  1804. const res = response.data.result
  1805. form.value.field7 = res.Owner_name || res.Owner.name || ''
  1806. soOwner.value = res.Owner_name || res.Owner.name || ''
  1807. form.value.Title = res.Sales_Order_Title_Job_Name || ''
  1808. form.value.saleOrderId = res.sales_orders_id || res.id || ''
  1809. form.value.PO_Date = dayjs(new Date()).format('YYYY-MM-DD')
  1810. let temp = []
  1811. if (res.details) {
  1812. temp = res.details.filter(
  1813. (item: any) => !productBlackList.includes(item.product_id),
  1814. )
  1815. } else if (res.Product_Details) {
  1816. temp = res.Product_Details.filter(
  1817. (item: any) => !productBlackList.includes(item.product.id),
  1818. )
  1819. }
  1820. if (!temp.length) return
  1821. form.value.productList = []
  1822. temp.forEach((item: any) => {
  1823. form.value.productList.push(
  1824. Object.assign({}, emptyProductItem, {
  1825. candidate: [
  1826. {
  1827. Product_Code: item.product_Product_Code,
  1828. label: item.product.name,
  1829. value: item.product.id,
  1830. },
  1831. ],
  1832. Product_Code: item.product.Product_Code,
  1833. id: item.product.id,
  1834. name: item.product.name,
  1835. label: item.product.name,
  1836. value: item.product.id,
  1837. desc: item.product_description || '',
  1838. quantity: Number(item.quantity),
  1839. }),
  1840. )
  1841. })
  1842. })
  1843. // 根据url传递过来的用户ID获取的用户身份信息
  1844. const userInfo = ref({} as IUser)
  1845. axios
  1846. .post('/api/common/getUsersData', { id: route.query.user })
  1847. .then((response) => {
  1848. const res = response.data
  1849. if (res.code !== 1) return
  1850. userInfo.value = res.result || {}
  1851. })
  1852. </script>
  1853. <style lang="scss" scoped>
  1854. .view-window {
  1855. height: 100vh;
  1856. width: 100vw;
  1857. position: fixed;
  1858. z-index: 999;
  1859. background-color: rgba(#fff, 0.3);
  1860. left: 0;
  1861. top: 0;
  1862. }
  1863. .screen {
  1864. margin: 0 auto;
  1865. font-size: 12pt;
  1866. line-height: 22pt;
  1867. }
  1868. .page-title-wrap {
  1869. padding: 12px 36px;
  1870. border-bottom: 1px solid #eee;
  1871. margin-bottom: 24px;
  1872. }
  1873. .page-title {
  1874. font-size: 36px;
  1875. margin-left: 8px;
  1876. }
  1877. .layout-left {
  1878. width: 435px;
  1879. min-width: 435px;
  1880. padding-right: 24px;
  1881. }
  1882. .layout-right {
  1883. position: relative;
  1884. border-left: 1px solid #eee;
  1885. padding: 0 24px;
  1886. }
  1887. .rule-item {
  1888. .el-form-item {
  1889. margin-bottom: 0;
  1890. }
  1891. }
  1892. .sign-wrap {
  1893. width: 100pt;
  1894. &.pangea {
  1895. width: 180pt;
  1896. }
  1897. img {
  1898. width: 100%;
  1899. }
  1900. }
  1901. .screen {
  1902. max-width: 1600px;
  1903. margin: 0 auto;
  1904. .company-info {
  1905. text-align: center;
  1906. font-size: 10pt;
  1907. color: $subColor;
  1908. margin-bottom: 16pt;
  1909. }
  1910. .company-name {
  1911. margin-bottom: 4pt;
  1912. color: $mainColor;
  1913. font-size: 16pt;
  1914. line-height: 22pt;
  1915. }
  1916. .company-addr {
  1917. line-height: 12pt;
  1918. height: 12pt;
  1919. }
  1920. .company-phone {
  1921. line-height: 12pt;
  1922. height: 12pt;
  1923. }
  1924. .company-fax {
  1925. line-height: 12pt;
  1926. height: 12pt;
  1927. }
  1928. .form-area {
  1929. position: relative;
  1930. }
  1931. .form-area-left {
  1932. width: 30%;
  1933. }
  1934. .form-area-right {
  1935. width: 45%;
  1936. position: relative;
  1937. text-align: right;
  1938. vertical-align: top;
  1939. .label {
  1940. display: inline-block;
  1941. width: 40%;
  1942. vertical-align: top;
  1943. }
  1944. .value {
  1945. width: 60%;
  1946. word-break: break-word;
  1947. display: inline-block;
  1948. }
  1949. }
  1950. .product-table-separator {
  1951. width: 95%;
  1952. }
  1953. .product-total-table {
  1954. display: inline-block;
  1955. border: 1px solid #eee;
  1956. min-width: 220pt;
  1957. border-radius: 8pt;
  1958. position: relative;
  1959. right: 0;
  1960. top: 0;
  1961. .total-item {
  1962. & > div {
  1963. display: inline-block;
  1964. height: 26pt;
  1965. line-height: 26pt;
  1966. padding: 0 8pt;
  1967. }
  1968. &:nth-of-type(n + 1) {
  1969. border-top: 1px solid #eee;
  1970. }
  1971. }
  1972. .label {
  1973. width: 50%;
  1974. text-align: right;
  1975. }
  1976. .value {
  1977. width: 50%;
  1978. text-align: left;
  1979. }
  1980. }
  1981. .product-table {
  1982. table {
  1983. border: 1pt solid #eee;
  1984. width: 100%;
  1985. }
  1986. tr:nth-of-type(n + 3) td {
  1987. border-top: 1pt solid #eee;
  1988. }
  1989. th {
  1990. text-align: center;
  1991. background-color: $tableHeaderBgColor;
  1992. }
  1993. td {
  1994. padding: 8pt 8pt 4pt;
  1995. min-width: 30pt;
  1996. max-width: 100pt;
  1997. }
  1998. th + th,
  1999. td + td {
  2000. border-left: 1pt solid #eee;
  2001. }
  2002. .action {
  2003. text-align: center;
  2004. width: 50pt;
  2005. }
  2006. .quantity,
  2007. .rate,
  2008. .amount,
  2009. .discount {
  2010. width: 80pt;
  2011. }
  2012. .requirement {
  2013. width: 180pt;
  2014. }
  2015. .product {
  2016. width: 180pt;
  2017. }
  2018. }
  2019. .note-form-area {
  2020. width: 40%;
  2021. }
  2022. .rule-item {
  2023. color: $subColor;
  2024. line-height: 26pt;
  2025. }
  2026. .sub-form-title {
  2027. padding-left: 4pt;
  2028. border-left: 2pt solid #efefef;
  2029. margin-bottom: 8pt;
  2030. }
  2031. }
  2032. .preview-area {
  2033. font-size: 10pt;
  2034. line-height: 22pt;
  2035. color: $mainColor;
  2036. box-sizing: border-box;
  2037. * {
  2038. padding: 0;
  2039. margin: 0;
  2040. }
  2041. .company-info {
  2042. text-align: center;
  2043. font-size: 9pt;
  2044. color: $subColor;
  2045. margin-bottom: 16pt;
  2046. }
  2047. .company-name {
  2048. margin-bottom: 4pt;
  2049. color: $mainColor;
  2050. font-size: 16pt;
  2051. line-height: 22pt;
  2052. }
  2053. .company-addr {
  2054. line-height: 12pt;
  2055. height: 12pt;
  2056. }
  2057. .company-phone {
  2058. line-height: 12pt;
  2059. height: 12pt;
  2060. }
  2061. .company-fax {
  2062. line-height: 12pt;
  2063. height: 12pt;
  2064. }
  2065. $titleWidth: 100%;
  2066. .pdf-title {
  2067. text-align: center;
  2068. font-size: 28pt;
  2069. line-height: 36pt;
  2070. height: 36pt;
  2071. width: $titleWidth;
  2072. margin: 0 auto;
  2073. background-color: #fff;
  2074. }
  2075. .pdf-title-bg {
  2076. width: 100%;
  2077. height: 2pt;
  2078. .center {
  2079. width: 33%;
  2080. text-align: center;
  2081. }
  2082. .right,
  2083. .left {
  2084. width: 33%;
  2085. height: 3pt;
  2086. line-height: 3pt;
  2087. & > div {
  2088. width: 100%;
  2089. height: 2pt;
  2090. line-height: 2pt;
  2091. background-color: $bgColor;
  2092. }
  2093. }
  2094. }
  2095. .form-area {
  2096. padding-top: 24pt;
  2097. line-height: 14pt;
  2098. $formAreaFontSize: 10pt;
  2099. white-space: pre-wrap;
  2100. font-size: $formAreaFontSize;
  2101. & > .flex-auto {
  2102. width: 50%;
  2103. & > div {
  2104. padding-bottom: 8pt;
  2105. }
  2106. }
  2107. .column-vendor {
  2108. vertical-align: top;
  2109. }
  2110. .column-form-label {
  2111. width: 40%;
  2112. }
  2113. .column-form-value {
  2114. width: 60%;
  2115. }
  2116. }
  2117. .product-table-separator {
  2118. width: 100%;
  2119. margin: 15pt auto 10pt;
  2120. height: 2pt;
  2121. background-color: $bgColor;
  2122. }
  2123. .product-table {
  2124. table {
  2125. margin: 0 auto 6pt;
  2126. width: 100%;
  2127. border-radius: 6pt;
  2128. text-align: left;
  2129. }
  2130. tr:nth-of-type(n + 1) td {
  2131. border-top: 1pt solid #eee;
  2132. }
  2133. th {
  2134. background-color: $bgColor;
  2135. min-width: 20pt;
  2136. padding: 0 2pt;
  2137. }
  2138. td {
  2139. min-width: 20pt;
  2140. max-width: 100pt;
  2141. padding: 0 2pt;
  2142. .desc {
  2143. white-space: pre-wrap;
  2144. line-height: 16pt;
  2145. color: $subColor;
  2146. }
  2147. }
  2148. .row-index {
  2149. width: 20pt;
  2150. }
  2151. }
  2152. .note-form-area {
  2153. width: 40%;
  2154. .label {
  2155. color: $subColor;
  2156. display: inline-block;
  2157. width: 40%;
  2158. vertical-align: top;
  2159. }
  2160. .value {
  2161. color: $subColor;
  2162. width: 60%;
  2163. word-break: break-word;
  2164. white-space: pre-wrap;
  2165. display: inline-block;
  2166. line-height: 16pt;
  2167. }
  2168. }
  2169. .sub-form-title {
  2170. color: $subColor;
  2171. font-weight: bold;
  2172. }
  2173. .rule-item {
  2174. color: $subColor;
  2175. line-height: 26pt;
  2176. }
  2177. .signature-area {
  2178. color: $subColor;
  2179. .first-party {
  2180. padding: 30pt 0 0;
  2181. }
  2182. .second-party {
  2183. padding: 20pt 0 40pt;
  2184. }
  2185. }
  2186. }
  2187. .preview-area2 {
  2188. .supplier-name {
  2189. font-size: 22pt;
  2190. text-align: center;
  2191. }
  2192. .billing-addr {
  2193. line-height: 18pt;
  2194. min-height: 18pt;
  2195. font-size: 12pt;
  2196. text-align: center;
  2197. }
  2198. .contact-info {
  2199. margin-bottom: 12pt;
  2200. min-height: 18pt;
  2201. line-height: 18pt;
  2202. font-size: 12pt;
  2203. }
  2204. .product-table {
  2205. table {
  2206. border: 1px solid $bgColor;
  2207. border-radius: 3pt;
  2208. margin: 0 auto 6pt;
  2209. width: 100%;
  2210. font-size: 10pt;
  2211. }
  2212. th {
  2213. text-align: left;
  2214. }
  2215. td {
  2216. white-space: pre-wrap;
  2217. }
  2218. th,
  2219. td {
  2220. padding: 4pt 6pt;
  2221. &:nth-of-type(n + 2) {
  2222. border-left: 1px solid $bgColor;
  2223. }
  2224. }
  2225. tr:nth-of-type(n + 2) {
  2226. td {
  2227. border-top: 1px solid $bgColor;
  2228. }
  2229. }
  2230. }
  2231. .table-title {
  2232. text-align: center;
  2233. font-weight: bold;
  2234. font-size: 16pt;
  2235. margin: 12pt auto 8pt;
  2236. }
  2237. .base-info-area {
  2238. margin-top: 12pt;
  2239. font-size: 11pt;
  2240. .base-info-label {
  2241. min-width: 90pt;
  2242. width: 90pt;
  2243. font-family: serif;
  2244. }
  2245. .base-info-value {
  2246. white-space: pre-wrap;
  2247. vertical-align: top;
  2248. flex: auto;
  2249. text-align: left;
  2250. font-family: sans-serif;
  2251. font-weight: 400;
  2252. }
  2253. .left {
  2254. padding-right: 8pt;
  2255. .base-info-label {
  2256. min-width: 60pt;
  2257. width: 60pt;
  2258. }
  2259. }
  2260. .right {
  2261. padding-left: 8pt;
  2262. }
  2263. .left,
  2264. .right {
  2265. width: 50%;
  2266. margin-bottom: 12pt;
  2267. }
  2268. }
  2269. .bank-info-area {
  2270. font-family: sans-serif;
  2271. font-weight: bold;
  2272. font-size: 11pt;
  2273. margin-bottom: 10pt;
  2274. .bank-info-label {
  2275. font-weight: bold;
  2276. font-family: serif;
  2277. width: 160pt;
  2278. max-width: 160pt;
  2279. }
  2280. .bank-info-value {
  2281. font-family: serif;
  2282. font-weight: normal;
  2283. }
  2284. }
  2285. }
  2286. @media print {
  2287. .screen {
  2288. display: none;
  2289. }
  2290. .preview-area,
  2291. .preview-area2 {
  2292. border: none;
  2293. border-color: transparent;
  2294. }
  2295. }
  2296. @media screen {
  2297. .print.hidden {
  2298. position: fixed;
  2299. right: -10000px;
  2300. bottom: -10000px;
  2301. }
  2302. .pdf-wrap {
  2303. position: relative;
  2304. width: 21cm;
  2305. min-height: 29.69cm;
  2306. margin: 20px auto;
  2307. box-shadow: 1px 1px 2pt 0px $subColor;
  2308. }
  2309. .preview-area,
  2310. .preview-area2 {
  2311. padding: 1cm;
  2312. }
  2313. }
  2314. </style>