edit.vue 91 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026
  1. <template>
  2. <div>
  3. <div
  4. v-if="loading"
  5. v-loading="true"
  6. class="view-window"
  7. element-loading-text="Loading..."
  8. element-loading-background="rgba(0, 0, 0, 0.3)"
  9. ></div>
  10. <div class="flex fixed-button-area">
  11. <!-- <el-button @click="() => generatePDF()">generatePDF</el-button> -->
  12. <el-button
  13. type="info"
  14. @click="formVisible = !formVisible"
  15. >
  16. <el-icon
  17. size="18px"
  18. color="#fff"
  19. >
  20. <Switch />
  21. </el-icon>
  22. &nbsp;{{ formVisible ? 'Preview PDF' : 'Show Form' }}
  23. </el-button>
  24. <el-button
  25. type="primary"
  26. :disabled="!formVisible"
  27. @click="checkForm(mainForm)"
  28. >
  29. <el-icon
  30. size="20px"
  31. color="#fff"
  32. >
  33. <FolderAdd />
  34. </el-icon>
  35. &nbsp;Save & Attach
  36. </el-button>
  37. </div>
  38. <div
  39. v-show="formVisible"
  40. class="screen"
  41. >
  42. <div class="flex 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
  62. label="Order Type"
  63. label-width="130px"
  64. >
  65. <el-radio-group v-model="form.Order_Type">
  66. <el-radio
  67. v-for="(item, index) in orderTypeList"
  68. :key="index"
  69. :label="item.label"
  70. >
  71. {{ item.label }}
  72. </el-radio>
  73. </el-radio-group>
  74. </el-form-item>
  75. <el-form-item
  76. label="Artwork Link"
  77. prop="Artwork_Link"
  78. label-width="130px"
  79. >
  80. <el-input
  81. v-model="form.Artwork_Link"
  82. placeholder="Please input"
  83. type="textarea"
  84. :rows="3"
  85. ></el-input>
  86. </el-form-item>
  87. <el-form-item
  88. label="Currency"
  89. label-width="130px"
  90. >
  91. <el-select
  92. v-model="form.Currency"
  93. style="width: 100%"
  94. placeholder="please select currency"
  95. >
  96. <el-option
  97. v-for="(item, index) in currencyList"
  98. :key="index"
  99. :label="item.label"
  100. :value="item.label"
  101. />
  102. </el-select>
  103. </el-form-item>
  104. <el-form-item
  105. v-if="recommandVendor.length"
  106. label="Suggest Supplier"
  107. label-width="130px"
  108. >
  109. <div class="flex column start">
  110. <div
  111. v-for="(item, index) in recommandVendor"
  112. :key="index"
  113. class="btn-quick-vendor"
  114. :class="{ active: item.id === form.currentVendor }"
  115. @click="quickSelectSupplier(item)"
  116. >
  117. {{ item.name || '' }}
  118. </div>
  119. </div>
  120. </el-form-item>
  121. </div>
  122. <div class="layout-right flex-auto">
  123. <div style="position: absolute; right: 24px; top: 0">
  124. <el-form-item label="Template:">
  125. <el-select
  126. v-model="currentCompany"
  127. style="width: 150px"
  128. @change="onCompanyTemplateChange"
  129. >
  130. <el-option
  131. v-for="company in computedCompanyList"
  132. :key="company.id"
  133. :value="company.id"
  134. :label="company.label"
  135. ></el-option>
  136. </el-select>
  137. </el-form-item>
  138. </div>
  139. <div class="company-info">
  140. <div class="company-name">{{ computedCompany.name }}</div>
  141. <div class="flex center">
  142. <div class="company-addr">
  143. 地址:&nbsp;{{ computedCompany.addr }}
  144. </div>
  145. <div class="company-phone">
  146. &nbsp;|&nbsp;电话:&nbsp;{{ computedCompany.phone }}
  147. </div>
  148. <div
  149. v-show="computedCompany.fax"
  150. class="company-fax"
  151. >
  152. &nbsp;|&nbsp;传真:&nbsp;{{ computedCompany.fax }}
  153. </div>
  154. </div>
  155. </div>
  156. <div class="pdf-title">采购合同</div>
  157. <div class="pdf-title-bg">
  158. <div class="left"></div>
  159. <div class="right"></div>
  160. </div>
  161. <div class="flex start between form-area">
  162. <div class="form-area-left">
  163. <div class="">
  164. <span style="color: #f56c6c">*</span>
  165. 供应商(乙方) :
  166. </div>
  167. <div>{{ computedVendor.Primary_Contact_name }}</div>
  168. <el-form-item
  169. label-width="0"
  170. prop="currentVendor"
  171. >
  172. <el-select
  173. v-model="form.currentVendor"
  174. :remote-method="utils.debounce(getSupplierLists, 1000)"
  175. remote
  176. style="width: 100%"
  177. :loading="vendorLoading"
  178. filterable
  179. clearable
  180. >
  181. <el-option
  182. v-for="option in vendorList"
  183. :key="option.value"
  184. :value="option.value"
  185. :label="option.label"
  186. ></el-option>
  187. </el-select>
  188. </el-form-item>
  189. <div
  190. v-if="typeof computedCompany.taxReimbursement === 'undefined'"
  191. style="white-space: pre-wrap"
  192. >
  193. {{ computedVendor.PDF_display }}
  194. </div>
  195. <div
  196. v-else
  197. style="white-space: pre-wrap"
  198. >
  199. {{ computedVendor.PDF_display2 }}
  200. </div>
  201. </div>
  202. <div class="form-area-right">
  203. <el-form-item label="采购订单 #:">
  204. Generate once PO submitted
  205. </el-form-item>
  206. <el-form-item label="订单号 # :">
  207. <el-input
  208. v-model="form.Reference"
  209. disabled
  210. ></el-input>
  211. </el-form-item>
  212. <el-form-item
  213. label="日期:"
  214. prop="PO_Date"
  215. >
  216. <el-date-picker
  217. v-model="form.PO_Date"
  218. format="YYYY-MM-DD"
  219. value-format="YYYY-MM-DD"
  220. style="width: 100%"
  221. type="date"
  222. placeholder=""
  223. ></el-date-picker>
  224. </el-form-item>
  225. <el-form-item label="付款方式 :">
  226. <el-select
  227. v-model="form.Supplier_Payment_Terms"
  228. style="width: 100%"
  229. >
  230. <el-option
  231. v-for="(item, index) in supplierPaymentTermsLists"
  232. :key="index"
  233. :value="item.label"
  234. :label="item.label"
  235. ></el-option>
  236. </el-select>
  237. </el-form-item>
  238. <el-form-item label="参考 :">
  239. <el-input v-model="form.Title"></el-input>
  240. </el-form-item>
  241. <!-- 退税版没有这几项 -->
  242. <template
  243. v-if="typeof computedCompany.taxReimbursement === 'undefined'"
  244. >
  245. <el-form-item label="收货详情 :">
  246. <el-select
  247. v-model="form.field9"
  248. style="width: 100%"
  249. >
  250. <el-option
  251. v-for="(item, index) in addressList"
  252. :key="index"
  253. :value="item.label"
  254. :label="item.label"
  255. ></el-option>
  256. </el-select>
  257. </el-form-item>
  258. <el-form-item
  259. label="收件人 :"
  260. prop="field7"
  261. >
  262. <el-input v-model="form.field7"></el-input>
  263. </el-form-item>
  264. <el-form-item
  265. label="联系电话 :"
  266. prop="field8"
  267. >
  268. <el-input v-model="form.field8"></el-input>
  269. </el-form-item>
  270. </template>
  271. <el-form-item
  272. label="工厂交货日期 :"
  273. prop="field6"
  274. >
  275. <el-date-picker
  276. v-model="form.field6"
  277. style="width: 100%"
  278. format="YYYY-MM-DD"
  279. value-format="YYYY-MM-DD"
  280. ></el-date-picker>
  281. </el-form-item>
  282. <el-form-item label="送货备注 :">
  283. <el-input v-model="form.Delivery_Details"></el-input>
  284. </el-form-item>
  285. </div>
  286. </div>
  287. <div class="product-table-separator"></div>
  288. <div class="product-table">
  289. <table
  290. border="0"
  291. cellspacing="0"
  292. >
  293. <tr>
  294. <th class="product">品名</th>
  295. <th class="quantity">数量</th>
  296. <th class="rate">价格</th>
  297. <th class="requirement">中文品目|要求</th>
  298. <th class="amount">金额</th>
  299. <th class="discount">折扣</th>
  300. <th class="action">操作</th>
  301. </tr>
  302. <tr
  303. v-for="(product, index) in form.productList"
  304. :key="index"
  305. >
  306. <td class="product">
  307. <el-form-item
  308. label=""
  309. label-width="0"
  310. :prop="'productList.' + index + '.id'"
  311. :rules="{
  312. required: true,
  313. message: '必填项',
  314. trigger: ['blur', 'change'],
  315. }"
  316. >
  317. <el-select-v2
  318. v-model="product.id"
  319. popper-class="product-select"
  320. style="width: 100%; margin-bottom: 4pt"
  321. :options="product.candidate"
  322. :loading="productLoading"
  323. :remote-method="(e:string) => getProductList(e, product)"
  324. remote
  325. filterable
  326. clearable
  327. @change="(e) => onProductSelect(e, product)"
  328. ></el-select-v2>
  329. </el-form-item>
  330. <el-input
  331. v-if="userInfo.Organization !== 'PrimePac'"
  332. v-model="product.desc"
  333. type="textarea"
  334. placeholder="Free text"
  335. ></el-input>
  336. </td>
  337. <td class="quantity">
  338. <el-form-item
  339. label=""
  340. label-width="0"
  341. :prop="'productList.' + index + '.quantity'"
  342. :rules="{
  343. required: true,
  344. message: '必填项',
  345. trigger: ['blur', 'change'],
  346. }"
  347. >
  348. <el-input
  349. v-model="product.quantity"
  350. type="number"
  351. min="1"
  352. @change="(e) => onInputChange(e, product, 'quantity')"
  353. ></el-input>
  354. </el-form-item>
  355. </td>
  356. <td class="rate">
  357. <el-form-item
  358. label=""
  359. label-width="0"
  360. :prop="'productList.' + index + '.rate'"
  361. :rules="{
  362. required: true,
  363. message: '必填项',
  364. trigger: ['blur', 'change'],
  365. }"
  366. >
  367. <el-input
  368. v-model="product.rate"
  369. type="number"
  370. @change="(e) => onInputChange(e, product, 'rate')"
  371. ></el-input>
  372. </el-form-item>
  373. </td>
  374. <td class="requirement">
  375. <el-input
  376. v-model="product.requirement"
  377. :rows="userInfo.Organization !== 'PrimePac' ? 4 : 5"
  378. type="textarea"
  379. placeholder="Free text"
  380. ></el-input>
  381. </td>
  382. <td class="amount">
  383. <el-input
  384. v-model="product.amount"
  385. type="number"
  386. disabled
  387. ></el-input>
  388. </td>
  389. <td class="discount">
  390. <el-input
  391. v-model="product.discount"
  392. type="number"
  393. @change="(e) => onInputChange(e, product, 'discount')"
  394. ></el-input>
  395. </td>
  396. <td class="action">
  397. <el-button
  398. size="small"
  399. type="danger"
  400. plain
  401. @click="form.productList.splice(index, 1)"
  402. >
  403. Delete
  404. </el-button>
  405. </td>
  406. </tr>
  407. </table>
  408. </div>
  409. <div>
  410. <el-button
  411. type="primary"
  412. size="small"
  413. plain
  414. @click="addRow"
  415. >
  416. Add Row
  417. </el-button>
  418. </div>
  419. <div class="flex end">
  420. <div class="product-total-table">
  421. <div class="total-item">
  422. <div class="label">Sub Total</div>
  423. <div class="value">{{ toFixed(subTotal, 2) }}</div>
  424. </div>
  425. <div class="total-item">
  426. <div class="label">Total Discount</div>
  427. <div class="value">
  428. {{ toFixed(totalDiscount, 2) }}
  429. </div>
  430. </div>
  431. <div class="total-item">
  432. <div class="label">Adjustment</div>
  433. <div class="value">
  434. <el-input
  435. v-model="adjustment"
  436. style="width: 100%"
  437. type="number"
  438. ></el-input>
  439. </div>
  440. </div>
  441. <div class="total-item">
  442. <div class="label">Grand Total</div>
  443. <div class="value">
  444. {{ toFixed(grandTotal, 2) }}
  445. </div>
  446. </div>
  447. </div>
  448. </div>
  449. <div class="note-form-area">
  450. <div class="sub-form-title">注意事项:</div>
  451. <el-form-item label="印刷质量:">
  452. <el-input
  453. v-model="form.field12"
  454. type="textarea"
  455. rows="3"
  456. ></el-input>
  457. </el-form-item>
  458. <el-form-item label="产品质量:">
  459. <el-input
  460. v-model="form.field13"
  461. type="textarea"
  462. rows="3"
  463. ></el-input>
  464. </el-form-item>
  465. <el-form-item label="质量承诺:">
  466. <el-input
  467. v-model="form.field10"
  468. type="textarea"
  469. rows="3"
  470. ></el-input>
  471. </el-form-item>
  472. <el-form-item label="箱子箱唛:">
  473. <el-input
  474. v-model="form.field11"
  475. type="textarea"
  476. rows="3"
  477. ></el-input>
  478. </el-form-item>
  479. </div>
  480. <div class="sub-form-title">服务条款</div>
  481. <template v-if="currentCompany === 'PangeaTaxReimbursement'">
  482. <div class="rule-item flex">
  483. 一、合同价为含税价,税率为:
  484. <span style="color: #f56c6c">*</span>
  485. <el-form-item
  486. label-width="10"
  487. prop="field4"
  488. :rules="{
  489. required: true,
  490. message: '必填项',
  491. trigger: ['blur', 'change'],
  492. }"
  493. >
  494. <el-input
  495. v-model="form.field4"
  496. size="small"
  497. style="width: 120px"
  498. >
  499. <template #append>%</template>
  500. </el-input>
  501. </el-form-item>
  502. </div>
  503. <div class="rule-item flex">
  504. 二、运费条款:
  505. <span style="color: #f56c6c">*</span>
  506. <el-form-item label-width="10">
  507. <el-select
  508. v-model="form.field5"
  509. size="small"
  510. style="width: 110px"
  511. >
  512. <el-option
  513. v-for="(item, index) in field5_lists"
  514. :key="index"
  515. :label="item.label"
  516. :value="item.label"
  517. ></el-option>
  518. </el-select>
  519. </el-form-item>
  520. </div>
  521. </template>
  522. <template
  523. v-if="['PrimePacCommon', 'PrimePacSoft'].includes(currentCompany)"
  524. >
  525. <div class="rule-item">
  526. 一、本采购订单签署原件一式两份,双方各持一份。经双方代表签字或盖章即可生效,并具有同等法律效力。
  527. </div>
  528. <div class="rule-item flex nowrap">
  529. 二、以上价格已含所有产品的制作费、包装费;由
  530. <span style="color: #f56c6c">*</span>
  531. <el-form-item label-width="10">
  532. <el-select
  533. v-model="form.field5"
  534. size="small"
  535. style="width: 110px"
  536. >
  537. <el-option
  538. v-for="(item, index) in field5_lists"
  539. :key="index"
  540. :label="item.label"
  541. :value="item.label"
  542. ></el-option>
  543. </el-select>
  544. </el-form-item>
  545. 运费送货到广州甲方指定的卸货地点,不含税,运费届时实报实销。
  546. </div>
  547. <div class="rule-item">
  548. 三、印刷及工艺要求:乙方需按照甲方图稿或指定样品进行生产,颜色对照潘通色卡或指定样品。
  549. </div>
  550. <div class="rule-item">
  551. 四、付款形式:
  552. <span>{{ form.Supplier_Payment_Terms }}</span>
  553. 。甲方在乙方完成大货时,先寄大货样品给乙方确认,确认后付清剩余尾款。甲方通过银行转帐的方式付款,乙方账户信息如上。
  554. </div>
  555. <div class="rule-item">
  556. 五、出货标准:五层出口空白硬纸箱,箱内套防潮袋。如实际出货包装与合约要求不符,甲方有权拒收整批货物。
  557. </div>
  558. <div class="rule-item">
  559. 六、订货时间:自合同成立,甲方支付定金并确认图稿后算起。
  560. </div>
  561. <div class="rule-item">
  562. 七、交货期限:自确认图稿时间算起,乙方应于
  563. <span>{{ form.field6 }}</span>
  564. 前生产好产品,甲方确认并支付剩余款项后,乙方在约定时间内安排发出剩余产品到甲方收货地址。
  565. </div>
  566. </template>
  567. <div
  568. v-for="(item, index) in currentServiceRule"
  569. :key="index"
  570. class="rule-item"
  571. :class="[{ sub: typeof item === 'object' }]"
  572. v-html="typeof item === 'object' ? item.value : item"
  573. ></div>
  574. <div
  575. v-if="currentCompany === 'PrimePacCommon'"
  576. class="flex stretch PrimePac-table"
  577. >
  578. <div class="flex column stretch">
  579. <div class="column-item flex center">制作要求</div>
  580. <div class="flex-auto column-item flex center">
  581. 产品外观要求
  582. </div>
  583. </div>
  584. <div class="flex-auto flex column stretch">
  585. <div
  586. v-for="(item, index) in PrimePacCommonRuleTableData"
  587. :key="index"
  588. class="flex stretch flex-auto"
  589. >
  590. <div class="column-item flex center">
  591. {{ item.project }}
  592. </div>
  593. <div class="column-item flex-auto flex center">
  594. {{ item.method }}
  595. </div>
  596. </div>
  597. </div>
  598. </div>
  599. <div
  600. v-if="currentCompany === 'PrimePacSoft'"
  601. class="flex column stretch PrimePac-table"
  602. >
  603. <div class="flex stretch">
  604. <div class="flex column stretch">
  605. <div class="column-item flex-auto flex center">制作要求</div>
  606. </div>
  607. <div class="flex-auto flex column stretch">
  608. <div
  609. v-for="(item, index) in PrimePacSoftRuleTableData1"
  610. :key="index"
  611. class="flex stretch flex-auto"
  612. >
  613. <div class="column-item flex center">
  614. {{ item.project }}
  615. </div>
  616. <div class="column-item flex-auto flex center">
  617. {{ item.method }}
  618. </div>
  619. </div>
  620. </div>
  621. </div>
  622. <div class="flex stretch">
  623. <div class="flex column stretch">
  624. <div class="column-item flex-auto flex center">
  625. 产品技术要求
  626. </div>
  627. </div>
  628. <div class="flex-auto flex column stretch">
  629. <div
  630. v-for="(item, index) in PrimePacSoftRuleTableData2"
  631. :key="index"
  632. class="flex stretch flex-auto"
  633. >
  634. <div class="column-item flex center">
  635. {{ item.project }}
  636. </div>
  637. <div class="column-item flex-auto flex center">
  638. {{ item.method }}
  639. </div>
  640. </div>
  641. </div>
  642. </div>
  643. </div>
  644. </div>
  645. </div>
  646. </el-form>
  647. <br />
  648. </div>
  649. <div
  650. class="print"
  651. :class="{ hidden: formVisible && !loading }"
  652. >
  653. <div class="pdf-wrap">
  654. <div
  655. id="pdfElement"
  656. ref="pdfElement"
  657. class="preview-area"
  658. >
  659. <div class="company-info">
  660. <div class="company-name">{{ computedCompany.name }}</div>
  661. <div class="flex center">
  662. <div class="company-addr">
  663. 地址:&nbsp;{{ computedCompany.addr }}
  664. </div>
  665. <div class="company-phone">
  666. &nbsp;|&nbsp;电话:&nbsp;{{ computedCompany.phone }}
  667. </div>
  668. <div
  669. v-show="computedCompany.fax"
  670. class="company-fax"
  671. >
  672. &nbsp;|&nbsp;传真:&nbsp;{{ computedCompany.fax }}
  673. </div>
  674. </div>
  675. </div>
  676. <div>
  677. <table class="pdf-title-bg">
  678. <tr>
  679. <td class="left">
  680. <div>&nbsp;</div>
  681. </td>
  682. <td class="center">
  683. <div class="pdf-title">采购合同</div>
  684. </td>
  685. <td class="right">
  686. <div>&nbsp;</div>
  687. </td>
  688. </tr>
  689. </table>
  690. </div>
  691. <div class="form-area flex start">
  692. <div class="flex-auto">
  693. <div>供应商(乙方) :</div>
  694. <div
  695. v-if="computedVendor.Primary_Contact_name"
  696. class="column-vendor"
  697. >
  698. {{ computedVendor.Primary_Contact_name }}
  699. </div>
  700. <div class="column-vendor">
  701. {{ computedVendor.label }}
  702. </div>
  703. <div
  704. v-if="typeof computedCompany.taxReimbursement === 'undefined'"
  705. class="column-vendor"
  706. >
  707. {{ computedVendor.PDF_display }}
  708. </div>
  709. <div
  710. v-else
  711. class="column-vendor"
  712. >
  713. {{ computedVendor.PDF_display2 }}
  714. </div>
  715. </div>
  716. <div class="flex-auto">
  717. <div class="flex">
  718. <div class="column-form-label">采购订单 #:</div>
  719. <div class="column-form-value">
  720. {{ longPONumber || '' }}
  721. </div>
  722. </div>
  723. <div class="flex">
  724. <div class="column-form-label">订单号 # :</div>
  725. <div class="column-form-value">
  726. {{ form.Reference }}
  727. </div>
  728. </div>
  729. <div class="flex">
  730. <div class="column-form-label">日期 :</div>
  731. <div class="column-form-value">
  732. {{ form.PO_Date }}
  733. </div>
  734. </div>
  735. <div class="flex">
  736. <div class="column-form-label">付款方式 :</div>
  737. <div class="column-form-value">
  738. {{
  739. form.Supplier_Payment_Terms !== '-None-'
  740. ? form.Supplier_Payment_Terms
  741. : ''
  742. }}
  743. </div>
  744. </div>
  745. <div class="flex start">
  746. <div class="column-form-label">参考 :</div>
  747. <div class="column-form-value">
  748. {{ form.Title }}
  749. </div>
  750. </div>
  751. <template
  752. v-if="typeof computedCompany.taxReimbursement === 'undefined'"
  753. >
  754. <div class="flex start">
  755. <div class="column-form-label">收货详情 :</div>
  756. <div class="column-form-value">
  757. {{ form.field9 }}
  758. </div>
  759. </div>
  760. <div class="flex">
  761. <div class="column-form-label">收件人 :</div>
  762. <div class="column-form-value">
  763. {{ form.field7 }}
  764. </div>
  765. </div>
  766. <div class="flex">
  767. <div class="column-form-label">联系电话 :</div>
  768. <div class="column-form-value">
  769. {{ form.field8 }}
  770. </div>
  771. </div>
  772. </template>
  773. <div class="flex">
  774. <div class="column-form-label">工厂交货日期 :</div>
  775. <div class="column-form-value">
  776. {{ form.field6 }}
  777. </div>
  778. </div>
  779. <div class="flex">
  780. <div class="column-form-label">送货备注 :</div>
  781. <div class="column-form-value">
  782. {{ form.Delivery_Details }}
  783. </div>
  784. </div>
  785. </div>
  786. </div>
  787. <div class="product-table-separator"></div>
  788. <div class="product-table">
  789. <table
  790. border="0"
  791. cellspacing="0"
  792. >
  793. <tr>
  794. <th class="row-index">#</th>
  795. <th>品名</th>
  796. <th v-if="userInfo.Organization !== 'PrimePac'">
  797. 中文品目|要求
  798. </th>
  799. <th>数量</th>
  800. <th>价格</th>
  801. <th>金额</th>
  802. </tr>
  803. <tr
  804. v-for="(product, index) in form.productList"
  805. :key="index"
  806. >
  807. <td class="row-index">{{ index + 1 }}.</td>
  808. <td>
  809. <div class="product-name">{{ product.name }}</div>
  810. <div
  811. v-if="userInfo.Organization !== 'PrimePac'"
  812. class="desc"
  813. >
  814. {{ product.desc }}
  815. </div>
  816. <div
  817. v-else
  818. class="desc"
  819. >
  820. {{ product.requirement }}
  821. </div>
  822. </td>
  823. <td v-if="userInfo.Organization !== 'PrimePac'">
  824. {{ product.requirement }}
  825. </td>
  826. <td>
  827. {{ product.quantity }}
  828. </td>
  829. <td>
  830. {{ currentCurrency.country
  831. }}{{ currentCurrency.symbol }}&nbsp;{{
  832. toFixed(Number(product.rate), computedDeci)
  833. }}
  834. </td>
  835. <td>
  836. {{ currentCurrency.country
  837. }}{{ currentCurrency.symbol }}&nbsp;{{
  838. toFixed(Number(product.amount), computedDeci)
  839. }}
  840. </td>
  841. </tr>
  842. </table>
  843. </div>
  844. <!-- <br /> -->
  845. <div class="flex between start">
  846. <div class="note-form-area">
  847. <div class="sub-form-title">注意事项:</div>
  848. <div class="">
  849. <div class="label">印刷质量:</div>
  850. <div class="value">{{ form.field12 }}</div>
  851. </div>
  852. <div class="">
  853. <div class="label">产品质量:</div>
  854. <div class="value">{{ form.field13 }}</div>
  855. </div>
  856. <div class="">
  857. <div class="label">质量承诺:</div>
  858. <div class="value">{{ form.field10 }}</div>
  859. </div>
  860. <div class="">
  861. <div class="label">箱子箱唛:</div>
  862. <div class="value">{{ form.field11 }}</div>
  863. </div>
  864. </div>
  865. <div class="product-total-table">
  866. <div class="total-item flex">
  867. <div class="label">小计&nbsp;</div>
  868. <div class="value">
  869. {{ currentCurrency.country
  870. }}{{ currentCurrency.symbol }}&nbsp;{{
  871. toFixed(subTotal, computedDeci)
  872. }}
  873. </div>
  874. </div>
  875. <div class="total-item flex">
  876. <div class="label">合计&nbsp;</div>
  877. <div class="value">
  878. {{ currentCurrency.country
  879. }}{{ currentCurrency.symbol }}&nbsp;{{
  880. toFixed(grandTotal, computedDeci)
  881. }}
  882. </div>
  883. </div>
  884. </div>
  885. </div>
  886. <br />
  887. <div class="sub-form-title">服务条款</div>
  888. <template v-if="currentCompany === 'PangeaTaxReimbursement'">
  889. <div class="rule-item">
  890. 一、合同价为含税价,税率为: {{ form.field4 }} %
  891. </div>
  892. <div class="rule-item">二、运费条款: {{ form.field5 }}</div>
  893. </template>
  894. <template
  895. v-if="['PrimePacCommon', 'PrimePacSoft'].includes(currentCompany)"
  896. >
  897. <div class="rule-item">
  898. 一、本采购订单签署原件一式两份,双方各持一份。经双方代表签字或盖章即可生效,并具有同等法律效力。
  899. </div>
  900. <div class="rule-item flex nowrap">
  901. 二、以上价格已含所有产品的制作费、包装费;由
  902. <span>{{ form.field5 }}</span>
  903. 运费送货到广州甲方指定的卸货地点,不含税,运费届时实报实销。
  904. </div>
  905. <div class="rule-item">
  906. 三、印刷及工艺要求:乙方需按照甲方图稿或指定样品进行生产,颜色对照潘通色卡或指定样品。
  907. </div>
  908. <div class="rule-item">
  909. 四、付款形式:
  910. <span>{{ form.Supplier_Payment_Terms }}</span>
  911. 。甲方在乙方完成大货时,先寄大货样品给乙方确认,确认后付清剩余尾款。甲方通过银行转帐的方式付款,乙方账户信息如上。
  912. </div>
  913. <div class="rule-item">
  914. 五、出货标准:五层出口空白硬纸箱,箱内套防潮袋。如实际出货包装与合约要求不符,甲方有权拒收整批货物。
  915. </div>
  916. <div class="rule-item">
  917. 六、订货时间:自合同成立,甲方支付定金并确认图稿后算起。
  918. </div>
  919. <div class="rule-item">
  920. 七、交货期限:自确认图稿时间算起,乙方应于
  921. <span>{{ form.field6 }}</span>
  922. 前生产好产品,甲方确认并支付剩余款项后,乙方在约定时间内安排发出剩余产品到甲方收货地址。
  923. </div>
  924. </template>
  925. <div
  926. v-for="(item, index) in currentServiceRule"
  927. :key="index"
  928. class="rule-item"
  929. :class="[{ sub: typeof item === 'object' }]"
  930. v-html="typeof item === 'object' ? item.value : item"
  931. ></div>
  932. <div
  933. v-if="currentCompany === 'PrimePacCommon'"
  934. class="flex stretch PrimePac-table"
  935. >
  936. <div class="flex column stretch">
  937. <div class="column-item flex center">制作要求</div>
  938. <div class="flex-auto column-item flex center">产品外观要求</div>
  939. </div>
  940. <div class="flex-auto flex column stretch">
  941. <div
  942. v-for="(item, index) in PrimePacCommonRuleTableData"
  943. :key="index"
  944. class="flex stretch flex-auto"
  945. >
  946. <div class="column-item flex center">
  947. {{ item.project }}
  948. </div>
  949. <div class="column-item flex-auto flex center">
  950. {{ item.method }}
  951. </div>
  952. </div>
  953. </div>
  954. </div>
  955. <div
  956. v-if="currentCompany === 'PrimePacSoft'"
  957. class="flex column stretch PrimePac-table"
  958. >
  959. <div class="flex stretch">
  960. <div class="flex column stretch">
  961. <div class="column-item flex-auto flex center">制作要求</div>
  962. </div>
  963. <div class="flex-auto flex column stretch">
  964. <div
  965. v-for="(item, index) in PrimePacSoftRuleTableData1"
  966. :key="index"
  967. class="flex stretch flex-auto"
  968. >
  969. <div class="column-item flex center">
  970. {{ item.project }}
  971. </div>
  972. <div class="column-item flex-auto flex center">
  973. {{ item.method }}
  974. </div>
  975. </div>
  976. </div>
  977. </div>
  978. <div class="flex stretch">
  979. <div class="flex column stretch">
  980. <div class="column-item flex-auto flex center">
  981. 产品技术要求
  982. </div>
  983. </div>
  984. <div class="flex-auto flex column stretch">
  985. <div
  986. v-for="(item, index) in PrimePacSoftRuleTableData2"
  987. :key="index"
  988. class="flex stretch flex-auto"
  989. >
  990. <div class="column-item flex center">
  991. {{ item.project }}
  992. </div>
  993. <div class="column-item flex-auto flex center">
  994. {{ item.method }}
  995. </div>
  996. </div>
  997. </div>
  998. </div>
  999. </div>
  1000. <br />
  1001. <div class="signature-area">
  1002. <div class="company-seal"></div>
  1003. <div class="first-party">
  1004. <div
  1005. class="flex"
  1006. style="align-items: flex-end"
  1007. >
  1008. <div v-show="!computedCompany.label.includes('Pangea')">
  1009. 甲方(盖章):
  1010. </div>
  1011. <div
  1012. class="sign-wrap"
  1013. :class="{ pangea: computedCompany.label.includes('Pangea') }"
  1014. >
  1015. <img
  1016. v-if="computedCompany.signPath"
  1017. :src="computedCompany.signPath"
  1018. alt=""
  1019. />
  1020. </div>
  1021. </div>
  1022. <div class="">代表人: {{ userInfo.full_name }}</div>
  1023. <div class="">日期: {{ form.PO_Date }}</div>
  1024. </div>
  1025. <div class="second-party">
  1026. <div class="">乙方(盖章):</div>
  1027. </div>
  1028. </div>
  1029. </div>
  1030. </div>
  1031. <div
  1032. v-if="computedCompany.taxReimbursement && false"
  1033. class="pdf-wrap"
  1034. >
  1035. <div
  1036. id=""
  1037. ref="pdfElement2"
  1038. class="preview-area2"
  1039. >
  1040. <div class="supplier-name">
  1041. {{ computedVendor.Suppliers_Name || computedVendor.Vendor_Name }}
  1042. </div>
  1043. <div class="billing-addr">
  1044. {{ computedVendor.Billing_Address || '' }}
  1045. </div>
  1046. <div class="flex around contact-info">
  1047. <div class="flex">
  1048. <div>Tel No.:</div>
  1049. <div>&nbsp;{{ computedVendor.Phone }}</div>
  1050. </div>
  1051. <div class="flex center">
  1052. <div>E-mail:</div>
  1053. <div class="">&nbsp;{{ computedVendor.Email }}</div>
  1054. </div>
  1055. </div>
  1056. <div class="base-info-area">
  1057. <div class="flex">
  1058. <div class="flex start left">
  1059. <div class="base-info-label">TO:</div>
  1060. <div
  1061. v-if="currentCompany === 'AZYTaxReimbursement'"
  1062. class="base-info-value"
  1063. >
  1064. Azy Trading Pty Ltd
  1065. </div>
  1066. <div
  1067. v-else-if="currentCompany === 'FOTTaxReimbursement'"
  1068. class="base-info-value"
  1069. >
  1070. Fair Ocean Trading Australia Pty Ltd
  1071. </div>
  1072. </div>
  1073. <div class="right flex">
  1074. <div class="base-info-label">Date:</div>
  1075. <div class="base-info-value">{{ form.PO_Date }}</div>
  1076. </div>
  1077. </div>
  1078. <div class="flex start">
  1079. <div class="left flex start">
  1080. <div class="base-info-label">ADD:</div>
  1081. <div>
  1082. <div
  1083. v-if="currentCompany === 'AZYTaxReimbursement'"
  1084. class="base-info-value"
  1085. >
  1086. UNIT 12,21/F WAYSON COMM BLDG NO 28 CONNAUGHT RD WEST SHEUNG
  1087. WAN, HK
  1088. </div>
  1089. <div
  1090. v-else-if="currentCompany === 'FOTTaxReimbursement'"
  1091. class="base-info-value"
  1092. >
  1093. 15/10 Chilvers Road, Thornleigh, NSW 2120
  1094. </div>
  1095. </div>
  1096. </div>
  1097. <div class="right flex">
  1098. <div class="base-info-label">P/I. NO.</div>
  1099. <div class="base-info-value">{{ longPONumber }}</div>
  1100. </div>
  1101. </div>
  1102. <div class="flex start">
  1103. <div class="left flex">
  1104. <div class="base-info-label">ATTN:</div>
  1105. <div class="base-info-value">Accounts</div>
  1106. </div>
  1107. <div class="right flex">
  1108. <div class="base-info-label">Reference:</div>
  1109. <div class="base-info-value">{{ PONumber }}</div>
  1110. </div>
  1111. </div>
  1112. <div class="flex start">
  1113. <div class="flex left">
  1114. <template v-if="currentCompany === 'FOTTaxReimbursement'">
  1115. <div class="base-info-label">TEL NO:</div>
  1116. <div class="base-info-value">02 9008 1322</div>
  1117. </template>
  1118. <div v-else></div>
  1119. </div>
  1120. <div class="right flex">
  1121. <div class="base-info-label">Payment Term:</div>
  1122. <div class="base-info-value">
  1123. {{ computedVendor.Supplier_Payment_Terms }}
  1124. </div>
  1125. </div>
  1126. </div>
  1127. </div>
  1128. <div class="table-title">PROFORMA INVOICE</div>
  1129. <div class="product-table">
  1130. <table cellspacing="0">
  1131. <tr>
  1132. <th>ITEM</th>
  1133. <th>DESCRIPTION</th>
  1134. <th>QTY(pcs)</th>
  1135. <th>UNIT PRICE</th>
  1136. <th>TOPTAL VALUE</th>
  1137. </tr>
  1138. <tr
  1139. v-for="(product, index) in form.productList"
  1140. :key="index"
  1141. >
  1142. <td>
  1143. <div>{{ product.name }}</div>
  1144. </td>
  1145. <td>
  1146. <div class="desc">{{ product.desc }}</div>
  1147. </td>
  1148. <td>
  1149. {{ product.quantity }}
  1150. </td>
  1151. <td>
  1152. {{ currentCurrency.country
  1153. }}{{ currentCurrency.symbol }}&nbsp;{{
  1154. toFixed(Number(product.rate), computedDeci)
  1155. }}
  1156. </td>
  1157. <td>
  1158. {{ currentCurrency.country
  1159. }}{{ currentCurrency.symbol }}&nbsp;{{
  1160. toFixed(Number(product.amount), computedDeci)
  1161. }}
  1162. </td>
  1163. </tr>
  1164. </table>
  1165. <div class="flex end">
  1166. <div
  1167. class="flex"
  1168. style="margin-top: 10pt"
  1169. >
  1170. <div style="margin: 0 100pt 0 0">TOTAL</div>
  1171. <div>
  1172. {{ currentCurrency.country
  1173. }}{{ currentCurrency.symbol }}&nbsp;{{ subTotal }}
  1174. </div>
  1175. </div>
  1176. </div>
  1177. </div>
  1178. <br />
  1179. <div class="bank-info-area">
  1180. <div class="flex">
  1181. <div>Bank Information</div>
  1182. <div></div>
  1183. </div>
  1184. <div class="flex">
  1185. <div class="bank-info-label">Beneficiary:</div>
  1186. <div class="bank-info-value">
  1187. {{ computedVendor.Suppliers_Name }}dd
  1188. </div>
  1189. </div>
  1190. <div class="flex">
  1191. <div class="bank-info-label">Bank:</div>
  1192. <div class="bank-info-value">
  1193. {{ computedVendor.Bank_Branch_Name }}
  1194. </div>
  1195. </div>
  1196. <div class="flex">
  1197. <div class="bank-info-label">Bank Add:</div>
  1198. <div class="bank-info-value">{{}}</div>
  1199. </div>
  1200. <div class="flex">
  1201. <div class="bank-info-label">A/C No.:</div>
  1202. <div class="bank-info-value">
  1203. {{ computedVendor.Bank_Account }}
  1204. </div>
  1205. </div>
  1206. <div class="flex">
  1207. <div class="bank-info-label">Bank Code:</div>
  1208. <div class="bank-info-value">{{}}</div>
  1209. </div>
  1210. <div class="flex">
  1211. <div class="bank-info-label">SWIFT CODE:</div>
  1212. <div class="bank-info-value">
  1213. {{ computedVendor.Swift_Code_IBAN }}
  1214. </div>
  1215. </div>
  1216. <div class="flex">
  1217. <div class="bank-info-label">Add:</div>
  1218. <div class="bank-info-value">{{}}</div>
  1219. </div>
  1220. </div>
  1221. <br />
  1222. <div class="flex between start">
  1223. <div class="">
  1224. <div class="">BUYERS' SIGNATURE</div>
  1225. <div class="sign-wrap">
  1226. <img
  1227. v-if="computedCompany.signPath"
  1228. :src="computedCompany.signPath"
  1229. alt=""
  1230. />
  1231. </div>
  1232. </div>
  1233. <div class="">
  1234. <div class="">SELLER'S SIGNATURE</div>
  1235. </div>
  1236. </div>
  1237. </div>
  1238. </div>
  1239. </div>
  1240. </div>
  1241. </template>
  1242. <script lang="ts">
  1243. export default defineComponent({
  1244. name: 'PurchaseOrderEdit',
  1245. })
  1246. </script>
  1247. <script lang="ts" setup>
  1248. import { computed, defineComponent, ref, unref, watch } from 'vue'
  1249. import { useRoute } from 'vue-router'
  1250. import {
  1251. ElButton,
  1252. ElSelectV2,
  1253. ElSelect,
  1254. ElOption,
  1255. ElIcon,
  1256. ElInput,
  1257. ElForm,
  1258. ElFormItem,
  1259. ElDatePicker,
  1260. ElMessage,
  1261. ElNotification,
  1262. ElRadioGroup,
  1263. ElRadio,
  1264. ElMessageBox,
  1265. } from 'element-plus'
  1266. import type { FormInstance, FormRules } from 'element-plus'
  1267. import { ShoppingCart, FolderAdd, Switch } from '@element-plus/icons-vue'
  1268. import request from '@/utils/axios'
  1269. import dayjs from 'dayjs'
  1270. import jspdf from 'jspdf'
  1271. import html2canvas from 'html2canvas'
  1272. import utils from '@/utils/index'
  1273. import variables from '@/assets/css/var.module.scss'
  1274. import {
  1275. ServiceTypeKeyEnum,
  1276. TypeService,
  1277. ISelectItem,
  1278. IProductItem,
  1279. IUser,
  1280. ICompanyItem,
  1281. IVendorItem,
  1282. IRecommandVendor,
  1283. IForm,
  1284. } from '@/interface'
  1285. computed(() => {
  1286. return variables
  1287. })
  1288. const formVisible = ref(true)
  1289. const loading = ref(false)
  1290. // 订单ID. 例如 5757019000000683001, 不是串号.
  1291. const POID = ref('')
  1292. // po 串号. 例如 PO2025
  1293. const PONumber = ref('')
  1294. // po 长串号. 例如 ZCPO2025
  1295. const longPONumber = ref('')
  1296. const mainForm = ref<FormInstance>()
  1297. const checkForm = function (formEl: FormInstance | undefined) {
  1298. if (!formEl) return
  1299. formEl.validate((valid, fields) => {
  1300. if (valid) {
  1301. submit()
  1302. } else {
  1303. console.log('check form has not pass!', fields)
  1304. ElMessage.error('请检查表单必填项')
  1305. }
  1306. })
  1307. }
  1308. const submit = () => {
  1309. loading.value = true
  1310. createPurchaseOrders()
  1311. .then((res) => {
  1312. // console.log(res)
  1313. getPurchaseOrdersData()
  1314. .then(() => {
  1315. generatePDF()
  1316. .then(() => {
  1317. ElNotification({
  1318. duration: 0,
  1319. type: 'success',
  1320. title: '任务已成功处理',
  1321. message: '本页面将自动跳转',
  1322. })
  1323. const url =
  1324. import.meta.env.VITE_PO_PATH +
  1325. POID.value +
  1326. import.meta.env.VITE_PO_APPEND
  1327. setTimeout(() => {
  1328. window.location.replace(url)
  1329. }, 1000)
  1330. })
  1331. .finally(() => {
  1332. loading.value = false
  1333. })
  1334. })
  1335. .catch(() => {
  1336. // loading.value = false
  1337. const msg = '获取PO详情失败, 未能正确生成PDF'
  1338. console.log(msg)
  1339. ElNotification({ duration: 0, title: msg, type: 'error' })
  1340. })
  1341. })
  1342. .catch(() => {
  1343. // loading.value = false
  1344. const msg = '创建PO失败'
  1345. console.log(msg)
  1346. ElNotification({ duration: 0, title: msg, type: 'error' })
  1347. })
  1348. }
  1349. const pdfElement = ref()
  1350. const pdfElement2 = ref()
  1351. const generatePDF = (ele = pdfElement, isFirstTime = true) => {
  1352. const A4_WIDTH = 592.28
  1353. const A4_HEIGHT = 841.89
  1354. let imageWrapper = unref(ele) // 获取DOM
  1355. // let pageHeight = (imageWrapper.scrollWidth / A4_WIDTH) * A4_HEIGHT
  1356. let pageHeight = (imageWrapper.clientWidth / A4_WIDTH) * A4_HEIGHT
  1357. let lableListID = imageWrapper.querySelectorAll('#pdfElement > div')
  1358. // 进行分割操作,当dom内容已超出a4的高度,则将该dom前插入一个空dom,把他挤下去,分割
  1359. for (let i = 0; i < lableListID.length; i++) {
  1360. let multiple = Math.ceil(
  1361. (lableListID[i].offsetTop + lableListID[i].offsetHeight) / pageHeight,
  1362. )
  1363. if (isSplit(lableListID, i, multiple * pageHeight)) {
  1364. let divParent = lableListID[i].parentNode // 获取该div的父节点
  1365. let newNode = document.createElement('div')
  1366. newNode.className = 'empty-div'
  1367. newNode.style.background = '#fff'
  1368. let _H =
  1369. multiple * pageHeight -
  1370. (lableListID[i].offsetTop + lableListID[i].offsetHeight)
  1371. //留白
  1372. newNode.style.height = _H + 40 + 'px'
  1373. newNode.style.width = '100%'
  1374. let next = lableListID[i].nextSibling // 获取div的下一个兄弟节点
  1375. // 判断兄弟节点是否存在
  1376. if (next) {
  1377. // 存在则将新节点插入到div的下一个兄弟节点之前,即div之后
  1378. divParent.insertBefore(newNode, next)
  1379. } else {
  1380. // 不存在则直接添加到最后,appendChild默认添加到divParent的最后
  1381. divParent.appendChild(newNode)
  1382. }
  1383. }
  1384. }
  1385. return new Promise((resolve, reject) => {
  1386. html2canvas(imageWrapper, {
  1387. allowTaint: true,
  1388. useCORS: true,
  1389. backgroundColor: '#fff', //一定要设背景颜色,否则有的浏览器就会变花~,比如Edge
  1390. scale: 3, // 缩放倍率调整清晰度
  1391. }).then((canvas) => {
  1392. let pdf = new jspdf('p', 'mm', 'a4') //A4纸,纵向
  1393. let ctx = canvas.getContext('2d'),
  1394. a4ContentWidth = 190,
  1395. a4ContentHeight = 277, //A4大小,210mm x 297mm,四边各保留10mm的边距,显示区域190x277
  1396. imgHeight = Math.floor(
  1397. (a4ContentHeight / a4ContentWidth) * canvas.width,
  1398. ), //按A4显示比例换算一页图像的像素高度
  1399. renderedHeight = 0
  1400. while (renderedHeight < canvas.height) {
  1401. let page = document.createElement('canvas')
  1402. page.width = canvas.width
  1403. page.height = Math.min(imgHeight, canvas.height - renderedHeight) //可能内容不足一页
  1404. //用getImageData剪裁指定区域,并画到前面创建的canvas对象中
  1405. // @ts-ignore: Object is possibly 'null'.
  1406. page
  1407. .getContext('2d')
  1408. .putImageData(
  1409. ctx!.getImageData(
  1410. 0,
  1411. renderedHeight,
  1412. canvas.width,
  1413. Math.min(imgHeight, canvas.height - renderedHeight),
  1414. ),
  1415. 0,
  1416. 0,
  1417. )
  1418. // document.body.appendChild(page)
  1419. pdf.addImage(
  1420. page.toDataURL('image/jpeg', 0.5),
  1421. 'JPEG',
  1422. 10,
  1423. 10,
  1424. a4ContentWidth,
  1425. Math.min(
  1426. a4ContentHeight,
  1427. a4ContentWidth * (page.height / page.width),
  1428. ),
  1429. ) //添加图像到页面,保留10mm边距
  1430. renderedHeight += imgHeight
  1431. if (renderedHeight < canvas.height) pdf.addPage() //如果后面还有内容,添加一个空页
  1432. }
  1433. const prefix =
  1434. `${PONumber.value}-${computedVendor.value.label}` +
  1435. (form.value.Title?.length ? `-${form.value.Title}` : '')
  1436. const fileName = isFirstTime ? prefix : prefix + '_2'
  1437. sendPDF(pdf.output('datauristring'), fileName)
  1438. .then(() => {
  1439. resolve(true)
  1440. })
  1441. .catch((e) => {
  1442. reject(e)
  1443. })
  1444. // 本地备份一下
  1445. pdf.save(fileName + '.pdf')
  1446. })
  1447. })
  1448. }
  1449. const isSplit = function (nodes: any, index: number, pageHeight: number) {
  1450. // 计算当前这块dom是否跨越了a4大小,以此分割
  1451. if (
  1452. nodes[index].offsetTop + nodes[index].offsetHeight < pageHeight &&
  1453. nodes[index + 1] &&
  1454. nodes[index + 1].offsetTop + nodes[index + 1].offsetHeight > pageHeight
  1455. ) {
  1456. return true
  1457. }
  1458. return false
  1459. }
  1460. const sendPDF = function (file: string, filename = `attachment_file`) {
  1461. const temp = file.split(',')
  1462. // @ts-ignore: Object is possibly 'null'.
  1463. const mimeType = temp[0].match(/:(.*?);/)[1]
  1464. let extName = mimeType.split('/')[1]
  1465. let bstr = window.atob(temp[1])
  1466. let n = bstr.length
  1467. let result = new Uint8Array(n)
  1468. while (n--) {
  1469. result[n] = bstr.charCodeAt(n)
  1470. }
  1471. const data = {
  1472. id: POID.value,
  1473. file: new File([result], `${filename}.${extName}`, { type: mimeType }),
  1474. }
  1475. return new Promise((resolve, reject) => {
  1476. request
  1477. .post('/Purchase_orders/uploadAttachmentFile', data, {
  1478. headers: {
  1479. 'Content-Type': 'multipart/form-data',
  1480. },
  1481. })
  1482. .then((response) => {
  1483. if (response.data.code !== 1) {
  1484. const msg = '自动创建附件失败'
  1485. ElNotification({ duration: 0, title: msg, type: 'error' })
  1486. reject(msg)
  1487. return
  1488. }
  1489. ElNotification({
  1490. duration: 0,
  1491. title: '自动创建 PDF 成功',
  1492. type: 'success',
  1493. })
  1494. resolve(true)
  1495. })
  1496. .catch((e) => {
  1497. reject(e)
  1498. })
  1499. })
  1500. }
  1501. const createPurchaseOrders = function () {
  1502. const data = JSON.parse(JSON.stringify(unref(form)))
  1503. data.Status = 'Created'
  1504. data.Sub_Total = subTotal.value
  1505. data.Total_Taxes = 0
  1506. data.Total_Discount = totalDiscount.value
  1507. data.Adjustment = Number(adjustment.value)
  1508. data.Grand_Total = grandTotal.value
  1509. data.Subject = '这里不用填'
  1510. data.Created_By = {
  1511. id: userInfo.value.users_id || route.query.user,
  1512. name: userInfo.value.full_name || '',
  1513. }
  1514. data.Owner = {
  1515. id: userInfo.value.users_id || route.query.user,
  1516. name: userInfo.value.full_name || '',
  1517. email: userInfo.value.email || '',
  1518. }
  1519. data.Vendor_Name = {
  1520. id: computedVendor.value.value,
  1521. name: computedVendor.value.label,
  1522. }
  1523. // console.log(data.Related_Sales_Order, 'ddd')
  1524. data.Related_Sales_Order = {
  1525. id: form.value.saleOrderId,
  1526. name: form.value.Title,
  1527. }
  1528. data.Purchase_Items = data.productList.map((item: any) => {
  1529. return {
  1530. Quantity: item.quantity,
  1531. Discount: item.discount || 0,
  1532. List_Price: item.rate,
  1533. Tax: 0,
  1534. total: item.amount,
  1535. total_after_discount: Number(item.amount) - Number(item.discount),
  1536. Net_Total: Number(item.amount) - Number(item.discount),
  1537. Description: item.desc,
  1538. Requirement: item.requirement,
  1539. line_tax: [],
  1540. // book: '',
  1541. // id: item.id,
  1542. product: {
  1543. // name: item.name,
  1544. id: item.id,
  1545. // Product_Code: item.Product_Code,
  1546. },
  1547. Product_Name: {
  1548. id: item.id,
  1549. },
  1550. // 这两个是crm有的, 但是文档没有
  1551. List_Price_Non_Currency: item.rate,
  1552. Price_Book_Name: '',
  1553. }
  1554. })
  1555. if (data.productList) delete data.productList
  1556. // console.log(data, 'create po params')
  1557. return new Promise((resolve, reject) => {
  1558. request
  1559. .post('/Purchase_orders/createPurchaseOrders', data, {})
  1560. .then((response) => {
  1561. if (response.data.code !== 1) return
  1562. const res = response.data.result
  1563. // console.log(res, 'create po')
  1564. if (res.data && res.data.length && res.data[0].code === 'SUCCESS') {
  1565. POID.value = res.data[0].details?.id || ''
  1566. resolve(res.data[0].details?.id)
  1567. ElNotification({
  1568. duration: 0,
  1569. title: '创建 Purchase Order 成功',
  1570. type: 'success',
  1571. })
  1572. } else {
  1573. ElNotification({
  1574. duration: 0,
  1575. title: '未能成功创建PO, 请稍后重试或者联系管理员',
  1576. type: 'error',
  1577. })
  1578. }
  1579. reject('未能成功创建PO')
  1580. })
  1581. .catch((e) => {
  1582. reject(e)
  1583. })
  1584. })
  1585. }
  1586. const getPurchaseOrdersData = function () {
  1587. return new Promise((resolve, reject) => {
  1588. request
  1589. .post('/purchase_orders/getPurchaseOrdersData', {
  1590. id: POID.value,
  1591. })
  1592. .then((response) => {
  1593. if (response.data.code !== 1) {
  1594. reject(false)
  1595. return
  1596. }
  1597. const res = Array.isArray(response.data.result)
  1598. ? response.data.result[0]
  1599. : response.data.result
  1600. longPONumber.value = res.PO_Number || ''
  1601. PONumber.value = res.Purchase_Order_Number || ''
  1602. resolve(true)
  1603. })
  1604. .catch((e) => {
  1605. reject(e)
  1606. })
  1607. })
  1608. }
  1609. const currencyList = ref([
  1610. {
  1611. label: 'AUD',
  1612. symbol: '',
  1613. country: '',
  1614. },
  1615. {
  1616. label: 'NZD',
  1617. symbol: '',
  1618. country: '',
  1619. },
  1620. {
  1621. label: 'CNY',
  1622. symbol: '¥',
  1623. country: 'CN',
  1624. },
  1625. {
  1626. label: 'GBP',
  1627. symbol: '',
  1628. country: '',
  1629. },
  1630. {
  1631. label: 'EUR',
  1632. symbol: '',
  1633. country: '',
  1634. },
  1635. {
  1636. label: 'USD',
  1637. symbol: '',
  1638. country: '',
  1639. },
  1640. ])
  1641. const currentCurrency = computed(() => {
  1642. const temp = currencyList.value.filter((i) => i.label === form.value.Currency)
  1643. // 2是人民币
  1644. return temp.length ? temp[0] : temp[2]
  1645. })
  1646. let orderTypeList = ref([
  1647. {
  1648. label: '-None-',
  1649. },
  1650. {
  1651. label: '打样',
  1652. },
  1653. {
  1654. label: '大货',
  1655. },
  1656. ])
  1657. const form = ref<IForm>({
  1658. Order_Type: '-None-',
  1659. Artwork_Link: '',
  1660. Currency: 'CNY',
  1661. // 订单号
  1662. saleOrderId: '',
  1663. Reference: '',
  1664. // 日期
  1665. PO_Date: '',
  1666. // 付款方式
  1667. Supplier_Payment_Terms: '-None-',
  1668. // 参考, so的job name
  1669. Title: '',
  1670. // 收货地址
  1671. field9: '广州市越秀区八旗二马路广东航运大厦1904室 邮编510110',
  1672. // 收件人
  1673. field7: '',
  1674. // 联系电话
  1675. field8: '18925020659',
  1676. // 工厂交货日期
  1677. field6: '',
  1678. productList: [
  1679. {
  1680. name: '',
  1681. id: '',
  1682. quantity: '',
  1683. rate: '',
  1684. requirement: '',
  1685. desc: '',
  1686. amount: 0,
  1687. discount: '',
  1688. candidate: [],
  1689. },
  1690. ] as IProductItem[],
  1691. // 印刷质量
  1692. field12: '',
  1693. // 产品质量
  1694. field13: '',
  1695. // 质量承诺
  1696. field10: '',
  1697. // 箱子箱唛
  1698. field11: '',
  1699. // 税率
  1700. field4: '0',
  1701. // 运费条款
  1702. field5: '供应商承担',
  1703. currentVendor: '',
  1704. Delivery_Details: '',
  1705. })
  1706. const formRule = ref<FormRules>({
  1707. Artwork_Link: [
  1708. {
  1709. required: true,
  1710. message: '必填项',
  1711. trigger: 'blur',
  1712. },
  1713. ],
  1714. PO_Date: [
  1715. {
  1716. required: true,
  1717. message: '必填项',
  1718. trigger: 'blur',
  1719. },
  1720. ],
  1721. // saleOrderId: [
  1722. // {
  1723. // required: true,
  1724. // message: '必填项',
  1725. // trigger: 'blur',
  1726. // },
  1727. // ],
  1728. field7: [
  1729. {
  1730. required: true,
  1731. message: '必填项',
  1732. trigger: 'blur',
  1733. },
  1734. ],
  1735. field8: [
  1736. {
  1737. required: true,
  1738. message: '必填项',
  1739. trigger: 'blur',
  1740. },
  1741. ],
  1742. field6: [
  1743. {
  1744. required: true,
  1745. message: '必填项',
  1746. trigger: 'blur',
  1747. },
  1748. ],
  1749. currentVendor: [
  1750. {
  1751. required: true,
  1752. message: '必填项',
  1753. trigger: 'change',
  1754. },
  1755. ],
  1756. })
  1757. const emptyProductItem = {
  1758. label: '',
  1759. value: '',
  1760. candidate: [],
  1761. name: '',
  1762. desc: '',
  1763. id: '',
  1764. quantity: '',
  1765. rate: '',
  1766. requirement: '',
  1767. // 未计算优惠(discount)之前的总额
  1768. amount: 0,
  1769. // 优惠额度
  1770. discount: '',
  1771. }
  1772. const addRow = function () {
  1773. form.value.productList.push(JSON.parse(JSON.stringify(emptyProductItem)))
  1774. }
  1775. const keyNeedCompute = ['quantity', 'rate']
  1776. const onInputChange = function (e: any, obj: IProductItem, key: string) {
  1777. // console.log(e, 'input value before enfore change')
  1778. if (typeof e === 'string') {
  1779. if (e.length) {
  1780. // 强制转换为数字类型
  1781. // obj[key] = Math.round(utils.multiply(Number(e))) / 100
  1782. obj[key] = Math.round(utils.multiply(Number(e), 1000)) / 1000
  1783. // 计算每行的总额
  1784. if (keyNeedCompute.includes(key)) {
  1785. obj.amount = utils.multiply(Number(obj.quantity), Number(obj.rate))
  1786. }
  1787. } else {
  1788. // obj[key] = minValue
  1789. }
  1790. }
  1791. }
  1792. const onProductSelect = function (e: any, product: IProductItem) {
  1793. if (e) {
  1794. const temp = product.candidate.filter((i) => i.value === e)
  1795. if (temp.length) {
  1796. product.name = temp[0].label
  1797. product.Product_Code = temp[0].Product_Code
  1798. }
  1799. getProductData(product.id).then((ctx) => {
  1800. product.requirement = ctx || ''
  1801. })
  1802. } else {
  1803. product.name = ''
  1804. }
  1805. }
  1806. // 小计
  1807. const subTotal = computed(() => {
  1808. return form.value.productList.reduce((total, current) => {
  1809. total = total + Number(current.amount)
  1810. return total
  1811. }, 0)
  1812. })
  1813. // 总优惠额度
  1814. const totalDiscount = computed(() => {
  1815. return form.value.productList.reduce((total, current) => {
  1816. total = total + Number(current.discount)
  1817. return total
  1818. }, 0)
  1819. })
  1820. // 价格统计修正值
  1821. const adjustment = ref<number | string>('')
  1822. // 总计
  1823. const grandTotal = computed(() => {
  1824. return subTotal.value - totalDiscount.value + Number(adjustment.value)
  1825. })
  1826. const productLoading = ref(false)
  1827. const getProductList = utils.debounce(
  1828. (keyword: string, target: IProductItem) => {
  1829. const key = keyword.trim()
  1830. if (!key.length) return
  1831. productLoading.value = true
  1832. const data = {
  1833. value: key,
  1834. name: 'Products',
  1835. api_name: 'Product_Name',
  1836. contains: 'contains',
  1837. page: 1,
  1838. limit: 20,
  1839. }
  1840. getSearchData(data)
  1841. .then((response) => {
  1842. if (response.data.code !== 1) return
  1843. const res = response.data.result
  1844. target.candidate = res.data.map((item: any) => {
  1845. return {
  1846. ...item,
  1847. label: item.Product_Name,
  1848. value: item.products_id || item.id,
  1849. }
  1850. })
  1851. })
  1852. .finally(() => {
  1853. productLoading.value = false
  1854. })
  1855. },
  1856. 1000,
  1857. )
  1858. const toFixed = function (value: number, ratio = 2) {
  1859. let r = 100
  1860. if (ratio === 3) {
  1861. r = 1000
  1862. }
  1863. return utils.toFixed(value, r)
  1864. }
  1865. const vendorList = ref<IVendorItem[]>([])
  1866. const computedVendor = computed(() => {
  1867. const temp = vendorList.value.filter(
  1868. (i) => i.value === form.value.currentVendor,
  1869. )
  1870. return temp.length
  1871. ? temp[0]
  1872. : {
  1873. Primary_Contact_name: '',
  1874. PDF_display: '',
  1875. PDF_display2: '',
  1876. label: '',
  1877. value: '',
  1878. Payment_Terms: '',
  1879. }
  1880. })
  1881. watch(computedVendor, () => {
  1882. if (
  1883. computedVendor.value.Payment_Terms &&
  1884. computedVendor.value.Payment_Terms.length
  1885. ) {
  1886. form.value.Supplier_Payment_Terms = computedVendor.value.Payment_Terms
  1887. }
  1888. })
  1889. const vendorLoading = ref(false)
  1890. const getSupplierLists = function (string: string) {
  1891. return new Promise((resolve, reject) => {
  1892. // 这个处理是为了兼容下拉框的实时防抖搜索 和 ((点击推荐供应商)快速勾选 的搜索)
  1893. const keyword = string.trim() || form.value.currentVendor?.trim() || ''
  1894. if (!keyword.length) {
  1895. reject('false')
  1896. return
  1897. }
  1898. const data = {
  1899. value: keyword,
  1900. name: 'Vendors',
  1901. api_name: 'Vendor_Name',
  1902. contains: 'contains',
  1903. page: 1,
  1904. limit: 100,
  1905. }
  1906. console.log('get supp run')
  1907. vendorLoading.value = true
  1908. getSearchData(data)
  1909. .then((response) => {
  1910. if (response.data.code !== 1) return false
  1911. const res = response.data.result || { data: [] }
  1912. vendorList.value = res.data
  1913. .filter((i: any) => !i.Hide_Record)
  1914. .map((i: any) => {
  1915. return {
  1916. ...i,
  1917. label: i.Suppliers_Name || i.Vendor_Name,
  1918. value: i.supplier_id || i.id,
  1919. Primary_Contact_name: i.Primary_Contact_name || '',
  1920. PDF_display: i.PDF_display || '',
  1921. PDF_display2: i.PDF_display2 || '',
  1922. }
  1923. })
  1924. vendorLoading.value = false
  1925. loading.value = false
  1926. resolve(true)
  1927. })
  1928. .catch((e) => reject(e))
  1929. })
  1930. }
  1931. const quickSelectSupplier = function (item: IRecommandVendor) {
  1932. form.value.currentVendor = item.id
  1933. loading.value = true
  1934. getSupplierLists(item.name)
  1935. }
  1936. const getSearchData = async function (p: any) {
  1937. return await request
  1938. .post('/common/getPublicLists', p, {
  1939. headers: { 'Content-Type': 'multipart/form-data' },
  1940. })
  1941. .then((response) => {
  1942. return response
  1943. })
  1944. }
  1945. const getPath = function (path: string) {
  1946. return new URL(path, import.meta.url).href
  1947. }
  1948. // 用于切换合同模版. Promo Collection 用户组使用.
  1949. const companyList = ref<ICompanyItem[]>([
  1950. {
  1951. id: 'PC',
  1952. label: 'PC',
  1953. name: '澳之原贸易有限公司',
  1954. addr: 'UNIT 12,21/F WAYSON COMM BLDG NO 28 CONNAUGHT RD WEST SHEUNG WAN,HK',
  1955. phone: '020-81609790',
  1956. signPath: getPath('/assets/sign/AZY.png'),
  1957. },
  1958. // {
  1959. // id: 'Pangea',
  1960. // label: 'Pangea',
  1961. // name: '庞吉亚国际商务服务(广州)有限公司',
  1962. // addr: '广州市越秀区八旗二马路48号内自编1号主楼自编1605、1606房',
  1963. // phone: '020-81609790',
  1964. // fax: '020-81519492',
  1965. // signPath: getPath('/assets/sign/Pangea.png'),
  1966. // },
  1967. {
  1968. id: 'PangeaTaxReimbursement',
  1969. label: 'Pangea_退税版',
  1970. name: '庞吉亚国际商务服务(广州)有限公司',
  1971. addr: '广州市越秀区八旗二马路48号内自编1号主楼自编1605、1606房',
  1972. phone: '020-81609790',
  1973. fax: '020-81519492',
  1974. // 名字叫退税版, 实际上合同没有第二份pdf. 判断是否退税版的依据是键名存在与否, 而不是这个值的真假
  1975. taxReimbursement: false,
  1976. signPath: getPath('/assets/sign/Pangea.png'),
  1977. },
  1978. // {
  1979. // id: 'AZYTaxReimbursement',
  1980. // label: 'AZY_退税版',
  1981. // name: '澳之原贸易有限公司',
  1982. // addr: 'UNIT 12,21/F WAYSON COMM BLDG NO 28 CONNAUGHT RD WEST SHEUNG WAN,HK',
  1983. // phone: '020-81609790',
  1984. // taxReimbursement: true,
  1985. // signPath: getPath('/assets/sign/AZY.png'),
  1986. // },
  1987. {
  1988. id: 'FOTTaxReimbursement',
  1989. label: 'FOT_退税版',
  1990. name: 'FAIR OCEAN TRADING AUSTRALIA PTY.LTD',
  1991. addr: '15/10 Chilvers Road, Thornleigh, NSW 2120',
  1992. phone: '020-81609790',
  1993. taxReimbursement: true,
  1994. signPath: getPath('/assets/sign/FOT.png'),
  1995. },
  1996. ])
  1997. // 用于切换合同模版. PrimePac 用户组的模版
  1998. const PrimePacList = ref<ICompanyItem[]>([
  1999. {
  2000. id: 'PrimePacCommon',
  2001. label: 'PrimePac Purchase order 通用版',
  2002. name: '澳之原贸易有限公司',
  2003. addr: 'UNIT 12,21/F WAYSON COMM BLDG NO 28 CONNAUGHT RD WEST SHEUNG WAN,HK',
  2004. phone: '020-81609790',
  2005. signPath: getPath('/assets/sign/AZY.png'),
  2006. },
  2007. {
  2008. id: 'PrimePacSoft',
  2009. label: 'PrimePac Purchase order 软包版',
  2010. name: '澳之原贸易有限公司',
  2011. addr: 'UNIT 12,21/F WAYSON COMM BLDG NO 28 CONNAUGHT RD WEST SHEUNG WAN,HK',
  2012. phone: '020-81609790',
  2013. signPath: getPath('/assets/sign/AZY.png'),
  2014. },
  2015. ])
  2016. const computedCompanyList = computed(() => {
  2017. return userInfo.value.Organization === 'PrimePac'
  2018. ? PrimePacList.value
  2019. : companyList.value
  2020. })
  2021. // 切换模版后的处理
  2022. const onCompanyTemplateChange = function () {
  2023. // 重置这两个字段
  2024. form.value.field5 = '供应商承担'
  2025. form.value.field4 = ''
  2026. if (typeof computedCompany.value.taxReimbursement === 'undefined') {
  2027. form.value.field7 = soOwner.value
  2028. form.value.field8 = '18925020659'
  2029. form.value.field9 = '广州市越秀区八旗二马路广东航运大厦1904室 邮编510110'
  2030. } else {
  2031. // 退税版没有这三个表单项, 直接重置值. 相应的, 非退税版要重新赋值.
  2032. form.value.field7 = ''
  2033. form.value.field8 = ''
  2034. form.value.field9 = ''
  2035. }
  2036. }
  2037. // 合同的服务条款
  2038. const serviceRule = ref<TypeService>({
  2039. PC: [
  2040. '一、本采购订单签署原件一式两份,双方各持一份。',
  2041. '二、验收标准:按乙方所寄样板及国家出口标准作为验收标准。',
  2042. '三、交货期限:交货期限必须严格执行。',
  2043. '四、交货地点:甲方广州公司地址,如上收货地址。',
  2044. '五、付款方式:甲方通过银行转帐的方式付款,乙方账户信息如上。',
  2045. '六、如因未能按上述标准及期限交货而产生经济损失,将由乙方承担。',
  2046. '七、凡因执行本合同所发生的或与本合同有关的一切争议,如经友好协商不能解决时,交由广州当地法院进行判决。',
  2047. ],
  2048. Pangea: [
  2049. '一、本采购订单签署原件一式两份,双方各持一份。',
  2050. '二、验收标准:按乙方所寄样板及国家出口标准作为验收标准。',
  2051. '三、交货期限:交货期限必须严格执行。',
  2052. '四、交货地点:甲方广州公司地址,如上收货地址。',
  2053. '五、付款方式:甲方通过银行转帐的方式付款,乙方账户信息如上。',
  2054. '六、如因未能按上述标准及期限交货而产生经济损失,将由乙方承担。',
  2055. '七、凡因执行本合同所发生的或与本合同有关的一切争议,如经友好协商不能解决时,交由广州当地法院进行判决。',
  2056. ],
  2057. PangeaTaxReimbursement: [
  2058. '三、本采购订单签署原件一式两份,双方各持一份。',
  2059. '四、验收标准:按乙方所寄样板及国家出口标准作为验收标准。',
  2060. '五、交货期限:交货期限必须严格执行。',
  2061. '六、交货地点: 广州市越秀区八旗二马路48号航运大厦1605、1606房',
  2062. '七、付款方式:甲方通过银行转帐的方式付款,乙方账户信息如上。',
  2063. '八、如因未能按上述标准及期限交货而产生经济损失,将由乙方承担。',
  2064. '九、凡因执行本合同所发生的或与本合同有关的一切争议,如经友好协商不能解决时,交由广州当地法院进行判决。',
  2065. '十、我司开票资料:',
  2066. '账户名称:庞吉亚国际商务服务(广州)有限公司',
  2067. '统一社会代码:91440101MA9XUQNB4B',
  2068. '公司地址:广州市越秀区八旗二马路48号内自编1号主楼16楼自编1605、1606房 ',
  2069. '公司电话:81609790',
  2070. '基本账户:中国光大银行股份有限公司广州分行越秀支行',
  2071. '账户号码:77910180803936888',
  2072. '开户银行地址:广州市越秀区文德南路69号',
  2073. ],
  2074. AZYTaxReimbursement: [
  2075. '一、本采购订单签署原件一式两份,双方各持一份。',
  2076. '二、验收标准:按乙方所寄样板及国家出口标准作为验收标准。',
  2077. '三、交货期限:交货期限必须严格执行。',
  2078. '四、收货地址:澳竣元代收,广州市越秀区八旗二马路48号航运大厦1902房。',
  2079. '五、付款方式:甲方通过银行转帐的方式付款,乙方账户信息如上。',
  2080. '六、如因未能按上述标准及期限交货而产生经济损失,将由乙方承担。',
  2081. '七、凡因执行本合同所发生的或与本合同有关的一切争议,如经友好协商不能解决时,交由广州当地法院进行判决。',
  2082. ],
  2083. FOTTaxReimbursement: [
  2084. '一、本采购订单签署原件一式两份,双方各持一份。',
  2085. '二、验收标准:按乙方所寄样板及国家出口标准作为验收标准。',
  2086. '三、交货期限:交货期限必须严格执行。',
  2087. '四、收货地址:澳竣元代收,广州市越秀区八旗二马路48号航运大厦1902房。',
  2088. '五、付款方式:甲方通过银行转帐的方式付款,乙方账户信息如上。',
  2089. '六、如因未能按上述标准及期限交货而产生经济损失,将由乙方承担。',
  2090. '七、凡因执行本合同所发生的或与本合同有关的一切争议,如经友好协商不能解决时,交由广州当地法院进行判决。',
  2091. ],
  2092. PrimePacCommon: [
  2093. '八、质量承诺:如甲方自收到货品之日起一个月内发现货品存在不符合合同约定的瑕疵,乙方应无条件包退包换,承担违约责任。承担违约需双方进行协商,达成解决方案。',
  2094. '九、如因未能按上述标准及期限交货而产生经济损失,将由乙方承担。',
  2095. '十、其他事项:',
  2096. {
  2097. value:
  2098. '1. 乙方应确保最终实际生产数量在合约确定数量±5%以内,同时提供一定数量的备品用于更换运输途中可能出现的损坏品。',
  2099. },
  2100. {
  2101. value:
  2102. '2. 乙方若预计交货时间将出现延误,应立刻通知甲方,与甲方另行约定发货时间并得到甲方确认。如乙方无法确定时间或再度延期,并未告知甲方合理延期原因,甲方有权要求乙方承当相应的违约责任并赔偿甲方相应损失。',
  2103. },
  2104. '十一、凡因执行本合同所发生的或与本合同有关的一切争议,如经友好协商不能解决时,交由广州当地法院进行判决。',
  2105. '附录:',
  2106. '产品制作要求及质量检验标准:',
  2107. {
  2108. value:
  2109. '1、乙方必须严格按甲方要求或产品销售国家/产品出口国最新的相关国家、行业标准对产品质量进行监控和检验。如在现场检验中发现乙方提供的产品不符合合同约定或与样板不符,乙方应在甲方要求的期限内补足、更换。补足、更换后的产品应符合合同要求。',
  2110. },
  2111. {
  2112. value:
  2113. '2、出货前甲方对合同项下产品按GB/T2828.1—2012抽样方法进行抽检,采用Ⅱ级检验水准,AQL值为:严重质量缺陷=1.0,重要质量缺陷=2.5,轻微质量缺陷=4.0 作为标准, 若检验不合格,甲方有权拒收整批货品。乙方应及时采取有效的措施补救,确保合同项下产品在合同交货期内按质、按量交货。如发生延误,则按本合同第七条的约定处理。',
  2114. },
  2115. ],
  2116. PrimePacSoft: [], // 跟 PrimePacCommon 完全相同
  2117. })
  2118. const currentServiceRule = computed(() => {
  2119. if (currentCompany.value === 'PrimePacSoft') {
  2120. return serviceRule.value['PrimePacCommon']
  2121. }
  2122. return serviceRule.value[currentCompany.value as ServiceTypeKeyEnum]
  2123. })
  2124. const currentCompany = ref('PC')
  2125. const computedCompany = computed(() => {
  2126. const result = computedCompanyList.value.filter(
  2127. (i) => i.id === currentCompany.value,
  2128. )
  2129. return result.length ? result[0] : computedCompanyList.value[0]
  2130. })
  2131. // 格式化输出价格的小数位数. 退税版需要显示三位小数, 其他只需要两位小数
  2132. const computedDeci = computed(() => {
  2133. return typeof computedCompany.value.taxReimbursement !== 'undefined' ? 3 : 2
  2134. })
  2135. // 候选 收货地址
  2136. let addressList = ref<ISelectItem[]>([])
  2137. // 候选 运费条款. 目前只有庞吉亚退税版用到, 其他模版默认供应商承担
  2138. let field5_lists = ref<ISelectItem[]>([])
  2139. let supplierPaymentTermsLists = ref<ISelectItem[]>([])
  2140. loading.value = true
  2141. // 获取下拉框非动态候选数据
  2142. const p1 = request
  2143. .post('/common/getfieldsData')
  2144. .then((response: any) => {
  2145. // console.log(response, '/common/getfieldsData')
  2146. const res = response.data.result
  2147. orderTypeList.value = res.Order_Type_lists.map((i: any) => {
  2148. return {
  2149. label: i,
  2150. }
  2151. })
  2152. addressList.value = res.field9_lists.map((i: any) => {
  2153. return {
  2154. label: i,
  2155. }
  2156. })
  2157. field5_lists.value = res.field5_lists
  2158. .filter((i: string) => !/^-?[Nn]one-?$/.test(i))
  2159. .map((i: any) => {
  2160. return {
  2161. label: i,
  2162. }
  2163. })
  2164. supplierPaymentTermsLists.value = res.Supplier_Payment_Terms_lists.map(
  2165. (i: any) => {
  2166. return {
  2167. label: i,
  2168. }
  2169. },
  2170. )
  2171. })
  2172. .catch((e) => {
  2173. console.log(e, '下拉框')
  2174. ElMessage.error('获取下拉框数据出错, 请联系管理员.')
  2175. })
  2176. const route = useRoute()
  2177. const productBlackList = ['4791186000046982872', '4791186000046982896']
  2178. const soOwner = ref('')
  2179. // 获取销售订单详情
  2180. const p2 = request
  2181. .post('/common/getSalesOrdersData', { id: route.params.id })
  2182. .then((response) => {
  2183. return response
  2184. })
  2185. // 获取对 该so对应客户的标注 并弹窗提醒
  2186. const getAccountsData = async (id: string) =>
  2187. request.post('/common/getAccountsData', { id }).then((response) => {
  2188. const res = response.data
  2189. if (res.code !== 1) return
  2190. if (res.result.User_Notes && res.result.User_Notes.length) {
  2191. ElMessageBox.alert(res.result.User_Notes, '', {
  2192. showClose: false,
  2193. })
  2194. }
  2195. })
  2196. const getProductData = async (id: string) =>
  2197. request.post('/common/getProductsData', { id }).then((response) => {
  2198. const res = response.data
  2199. if (res.code !== 1) return
  2200. // console.log(res.result)
  2201. if (userInfo.value.Organization === 'PrimePac') {
  2202. return '产品名称:\n尺寸:\n材质:\n工艺:\n颜色:\n其他备注:'
  2203. } else {
  2204. return res.result?.CF3 || ''
  2205. }
  2206. })
  2207. const recommandVendor = ref<IRecommandVendor[]>([])
  2208. const getRecommamdSupplier = async (id: string) =>
  2209. request.post('/common/getProductsOftenLists', { id }).then((response) => {
  2210. const res = response.data
  2211. if (res.code !== 1) return
  2212. recommandVendor.value = recommandVendor.value.concat(
  2213. Array.isArray(res.result) ? res.result : [],
  2214. )
  2215. })
  2216. // 根据url传递过来的用户ID获取的用户身份信息
  2217. const userInfo = ref({} as IUser)
  2218. const p3 = request
  2219. .post('/common/getUsersData', { id: route.query.user })
  2220. .then((response) => {
  2221. const res = response.data
  2222. if (res.code !== 1) return
  2223. if (res.result.users && res.result.users.length) {
  2224. userInfo.value = res.result.users[0]
  2225. } else if (res.result.id) {
  2226. userInfo.value = res.result || {}
  2227. } else if (Array.isArray(res.result) && res.result.length) {
  2228. userInfo.value = res.result[0] || {}
  2229. } else {
  2230. ElMessage.error('获取当前用户身份异常, 请联系管理员')
  2231. }
  2232. // 根据用户 ‘组织’ 切换模版默认选中项
  2233. if (userInfo.value.Organization === 'PrimePac') {
  2234. currentCompany.value = 'PrimePacCommon'
  2235. } else {
  2236. currentCompany.value = 'PC'
  2237. }
  2238. })
  2239. Promise.all([
  2240. p1,
  2241. p2,
  2242. p3,
  2243. getAccountsData,
  2244. getRecommamdSupplier(route.params.id as string),
  2245. ])
  2246. .then((array: any[]) => {
  2247. // console.log(array, 'all res')
  2248. // p2的数据处理逻辑从原本的p2then移动到这里处理.
  2249. // 因为要根据p3用户数据的Organization 来填充产品列表里面的 requirement, 这步处理必须放在p3后面, 而p2 p3是并发操作.
  2250. if (array[1].data.code !== 1) return
  2251. const res = array[1].data.result
  2252. if (res.Account_Name && res.Account_Name.id) {
  2253. getAccountsData(res.Account_Name.id)
  2254. }
  2255. form.value.field7 = res.Owner_name || res.Owner.name || ''
  2256. soOwner.value = res.Owner_name || res.Owner.name || ''
  2257. form.value.Title =
  2258. res.Contract_Title || res.Sales_Order_Title_Job_Name || ''
  2259. form.value.saleOrderId = res.sales_orders_id || res.id || ''
  2260. form.value.PO_Date = dayjs(new Date()).format('YYYY-MM-DD')
  2261. form.value.Reference = res.Reference || ''
  2262. form.value.Artwork_Link = res.Artwork_Link || ''
  2263. let temp = []
  2264. if (res.details) {
  2265. temp = res.details.filter(
  2266. (item: any) => !productBlackList.includes(item.product_id),
  2267. )
  2268. } else if (res.Product_Details) {
  2269. temp = res.Product_Details.filter(
  2270. (item: any) => !productBlackList.includes(item.product.id),
  2271. )
  2272. }
  2273. if (!temp.length) return
  2274. form.value.productList = []
  2275. temp.forEach((item: any) => {
  2276. getProductData(item.product.id).then((ctx) => {
  2277. form.value.productList.push(
  2278. Object.assign({}, emptyProductItem, {
  2279. candidate: [
  2280. {
  2281. Product_Code: item.product_Product_Code,
  2282. label: item.product.name,
  2283. value: item.product.id,
  2284. },
  2285. ],
  2286. Product_Code: item.product.Product_Code,
  2287. id: item.product.id,
  2288. name: item.product.name,
  2289. label: item.product.name,
  2290. value: item.product.id,
  2291. desc: item.product_description || '',
  2292. quantity: Number(item.quantity),
  2293. requirement: ctx || '',
  2294. }),
  2295. )
  2296. })
  2297. })
  2298. })
  2299. .finally(() => {
  2300. loading.value = false
  2301. })
  2302. interface PrimePacTable {
  2303. project: string
  2304. method: string
  2305. }
  2306. const PrimePacCommonRuleTableData = [
  2307. {
  2308. project: '检验项目',
  2309. method: '产品质量检测方法与标准',
  2310. },
  2311. {
  2312. project: '尺寸',
  2313. method: '参考上述产品尺寸',
  2314. },
  2315. {
  2316. project: '印刷',
  2317. method:
  2318. '1、成品整洁,无明显印刷瑕疵范畴的脏污、残缺、刀丝;\n2、文字印刷清晰完整,印迹边缘光洁,渐变区域清晰均匀;\n3、无明显变形和残缺,套印基本准确,同色之间基本无色差;',
  2319. },
  2320. {
  2321. project: '复合',
  2322. method: '无明显气泡,无分层',
  2323. },
  2324. {
  2325. project: '表面',
  2326. method: '平整,无明显气泡,无刮花,无明显溢胶',
  2327. },
  2328. {
  2329. project: '其他',
  2330. method: '不允许出现划伤、烫伤、穿孔、异味、粘连异物、脏污',
  2331. },
  2332. {
  2333. project: '特殊',
  2334. method: '/',
  2335. },
  2336. ]
  2337. // 软包版表格数据
  2338. const PrimePacSoftRuleTableData1: PrimePacTable[] = [
  2339. {
  2340. project: '检验项目',
  2341. method: '产品质量检测方法与标准',
  2342. },
  2343. {
  2344. project: '印刷',
  2345. method:
  2346. '1、成品整洁,无明显印刷瑕疵范畴的脏污、残缺、刀丝;\n2、文字印刷清晰完整,印迹边缘光洁,渐变区域清晰均匀;\n3、无明显变形和残缺,套印基本准确,同色之间基本无色差;\n4、与颜色标准无明显色差(将提供明确的颜色标准)',
  2347. },
  2348. {
  2349. project: '复合',
  2350. method: '无明显气泡,无分层',
  2351. },
  2352. {
  2353. project: '热封',
  2354. method: '平整,无虚封,无明显气泡',
  2355. },
  2356. {
  2357. project: '其他',
  2358. method: '不允许出现划伤、烫伤、穿孔、异味、粘连异物、脏污',
  2359. },
  2360. ]
  2361. const PrimePacSoftRuleTableData2: PrimePacTable[] = [
  2362. {
  2363. project: '溶剂残留量',
  2364. method:
  2365. '按照GB/T 10004的6.6.17条规定执行\n总溶剂残留量≤10mg/m2\n苯系溶剂残留量≤2mg/m2',
  2366. },
  2367. {
  2368. project: '复合强度',
  2369. method: '按照GB/T 8808的规定执行\n≥1.0 N/15mm',
  2370. },
  2371. {
  2372. project: '热封强度',
  2373. method: '按照GB/T 2358的规定执行\n≥20 N/15mm',
  2374. },
  2375. {
  2376. project: '耐压性能',
  2377. method: '按照GB/T 10004的6.6.8条规定执行\n120N下无渗漏,无破裂',
  2378. },
  2379. {
  2380. project: '熟化时间',
  2381. method: '熟化时间不少于48小时',
  2382. },
  2383. ]
  2384. </script>
  2385. <style lang="scss">
  2386. input[type='number'] {
  2387. -moz-appearance: textfield;
  2388. appearance: textfield;
  2389. &:hover {
  2390. -moz-appearance: textfield;
  2391. appearance: textfield;
  2392. &::-webkit-inner-spin-button,
  2393. &::-webkit-outer-spin-button {
  2394. -webkit-appearance: none;
  2395. margin: 0;
  2396. }
  2397. }
  2398. &::-webkit-inner-spin-button,
  2399. &::-webkit-outer-spin-button {
  2400. -webkit-appearance: none;
  2401. margin: 0;
  2402. }
  2403. }
  2404. .product-select {
  2405. .el-select-dropdown__list {
  2406. min-width: 400px;
  2407. max-width: 500px;
  2408. }
  2409. }
  2410. </style>
  2411. <style lang="scss" scoped>
  2412. .view-window {
  2413. height: 100vh;
  2414. width: 100vw;
  2415. position: fixed;
  2416. z-index: 999;
  2417. background-color: rgba(#fff, 0.3);
  2418. left: 0;
  2419. top: 0;
  2420. }
  2421. .fixed-button-area {
  2422. position: fixed;
  2423. top: 20px;
  2424. right: 24px;
  2425. z-index: 2;
  2426. @media screen and (min-width: 1600px) {
  2427. right: calc((100% - 1600px) / 2 + 24px);
  2428. }
  2429. }
  2430. .screen {
  2431. margin: 0 auto;
  2432. font-size: 12pt;
  2433. line-height: 22pt;
  2434. }
  2435. .print {
  2436. padding: 20px 0;
  2437. }
  2438. .page-title-wrap {
  2439. padding: 12px 36px;
  2440. border-bottom: 1px solid #eee;
  2441. margin-bottom: 24px;
  2442. }
  2443. .page-title {
  2444. font-size: 36px;
  2445. margin-left: 8px;
  2446. }
  2447. .layout-left {
  2448. width: 435px;
  2449. min-width: 435px;
  2450. padding-right: 12px;
  2451. }
  2452. .layout-right {
  2453. position: relative;
  2454. border-left: 1px solid #eee;
  2455. padding: 0 24px;
  2456. }
  2457. .rule-item {
  2458. margin-bottom: 2px;
  2459. color: $subColor;
  2460. line-height: 26pt;
  2461. &.sub {
  2462. line-height: 20pt;
  2463. padding-left: 24px;
  2464. }
  2465. &.nowrap {
  2466. white-space: nowrap;
  2467. }
  2468. .el-form-item {
  2469. margin-bottom: 0;
  2470. }
  2471. }
  2472. .btn-quick-vendor {
  2473. border: 1px solid #dcdfe6;
  2474. border-radius: 4px;
  2475. cursor: pointer;
  2476. padding: 0 8px;
  2477. margin-bottom: 6px;
  2478. &.active {
  2479. color: #fff;
  2480. background-color: #409eff;
  2481. }
  2482. }
  2483. .PrimePac-table {
  2484. margin: 12px auto;
  2485. width: 100%;
  2486. border-bottom: 1px solid #dcdfe6;
  2487. border-right: 1px solid #dcdfe6;
  2488. .column-item {
  2489. color: $subColor;
  2490. white-space: pre-wrap;
  2491. padding: 0 4px;
  2492. line-height: 20pt;
  2493. min-width: 120px;
  2494. min-height: 20pt;
  2495. border-top: 1px solid #dcdfe6;
  2496. border-left: 1px solid #dcdfe6;
  2497. }
  2498. }
  2499. .sign-wrap {
  2500. width: 100pt;
  2501. &.pangea {
  2502. width: 180pt;
  2503. }
  2504. img {
  2505. width: 100%;
  2506. }
  2507. }
  2508. .screen {
  2509. background-color: rgba(#fff, 1);
  2510. box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.4) inset,
  2511. 0 0.5em 1em rgba(0, 0, 0, 0.6);
  2512. max-width: 1600px;
  2513. min-width: 1200px;
  2514. margin: 0 auto;
  2515. .company-info {
  2516. text-align: center;
  2517. font-size: 10pt;
  2518. color: $subColor;
  2519. margin-bottom: 16pt;
  2520. }
  2521. .company-name {
  2522. margin-bottom: 4pt;
  2523. color: $mainColor;
  2524. font-size: 16pt;
  2525. line-height: 22pt;
  2526. }
  2527. .company-addr {
  2528. line-height: 12pt;
  2529. height: 12pt;
  2530. }
  2531. .company-phone {
  2532. line-height: 12pt;
  2533. height: 12pt;
  2534. }
  2535. .company-fax {
  2536. line-height: 12pt;
  2537. height: 12pt;
  2538. }
  2539. .form-area {
  2540. position: relative;
  2541. }
  2542. .form-area-left {
  2543. width: 30%;
  2544. }
  2545. .form-area-right {
  2546. width: 45%;
  2547. position: relative;
  2548. text-align: right;
  2549. vertical-align: top;
  2550. .label {
  2551. display: inline-block;
  2552. width: 40%;
  2553. vertical-align: top;
  2554. }
  2555. .value {
  2556. width: 60%;
  2557. word-break: break-word;
  2558. display: inline-block;
  2559. }
  2560. }
  2561. .product-table-separator {
  2562. width: 95%;
  2563. }
  2564. .product-total-table {
  2565. display: inline-block;
  2566. border: 1px solid #eee;
  2567. min-width: 220pt;
  2568. border-radius: 8pt;
  2569. position: relative;
  2570. right: 0;
  2571. top: 0;
  2572. .total-item {
  2573. & > div {
  2574. display: inline-block;
  2575. height: 26pt;
  2576. line-height: 26pt;
  2577. padding: 0 8pt;
  2578. }
  2579. &:nth-of-type(n + 1) {
  2580. border-top: 1px solid #eee;
  2581. }
  2582. }
  2583. .label {
  2584. width: 50%;
  2585. text-align: right;
  2586. }
  2587. .value {
  2588. width: 50%;
  2589. text-align: left;
  2590. }
  2591. }
  2592. .product-table {
  2593. table {
  2594. border: 1pt solid #eee;
  2595. width: 100%;
  2596. }
  2597. tr:nth-of-type(n + 3) td {
  2598. border-top: 1pt solid #eee;
  2599. }
  2600. th {
  2601. text-align: center;
  2602. background-color: $tableHeaderBgColor;
  2603. }
  2604. td {
  2605. padding: 8pt 8pt 4pt;
  2606. min-width: 30pt;
  2607. max-width: 100pt;
  2608. }
  2609. th + th,
  2610. td + td {
  2611. border-left: 1pt solid #eee;
  2612. }
  2613. .action {
  2614. text-align: center;
  2615. width: 50pt;
  2616. }
  2617. .quantity,
  2618. .rate,
  2619. .amount,
  2620. .discount {
  2621. width: 80pt;
  2622. }
  2623. .requirement {
  2624. width: 180pt;
  2625. }
  2626. .product {
  2627. width: 180pt;
  2628. }
  2629. }
  2630. .note-form-area {
  2631. width: 40%;
  2632. }
  2633. .sub-form-title {
  2634. padding-left: 4pt;
  2635. border-left: 2pt solid #efefef;
  2636. margin-bottom: 8pt;
  2637. }
  2638. }
  2639. .preview-area {
  2640. background-color: #fff;
  2641. font-size: 10pt;
  2642. line-height: 22pt;
  2643. color: $mainColor;
  2644. box-sizing: border-box;
  2645. * {
  2646. padding: 0;
  2647. margin: 0;
  2648. }
  2649. .company-info {
  2650. text-align: center;
  2651. font-size: 9pt;
  2652. color: $subColor;
  2653. margin-bottom: 16pt;
  2654. }
  2655. .company-name {
  2656. margin-bottom: 4pt;
  2657. color: $mainColor;
  2658. font-size: 16pt;
  2659. line-height: 22pt;
  2660. }
  2661. .company-addr {
  2662. line-height: 12pt;
  2663. height: 12pt;
  2664. }
  2665. .company-phone {
  2666. line-height: 12pt;
  2667. height: 12pt;
  2668. }
  2669. .company-fax {
  2670. line-height: 12pt;
  2671. height: 12pt;
  2672. }
  2673. $titleWidth: 100%;
  2674. .pdf-title {
  2675. text-align: center;
  2676. font-size: 28pt;
  2677. line-height: 36pt;
  2678. height: 36pt;
  2679. width: $titleWidth;
  2680. margin: 0 auto;
  2681. background-color: #fff;
  2682. }
  2683. .pdf-title-bg {
  2684. width: 100%;
  2685. height: 2pt;
  2686. .center {
  2687. width: 33%;
  2688. text-align: center;
  2689. }
  2690. .right,
  2691. .left {
  2692. width: 33%;
  2693. height: 3pt;
  2694. line-height: 3pt;
  2695. & > div {
  2696. width: 100%;
  2697. height: 2pt;
  2698. line-height: 2pt;
  2699. background-color: $bgColor;
  2700. }
  2701. }
  2702. }
  2703. .form-area {
  2704. padding-top: 24pt;
  2705. line-height: 14pt;
  2706. $formAreaFontSize: 10pt;
  2707. white-space: pre-wrap;
  2708. font-size: $formAreaFontSize;
  2709. & > .flex-auto {
  2710. width: 50%;
  2711. & > div {
  2712. padding-bottom: 8pt;
  2713. }
  2714. &:first-of-type {
  2715. padding-right: 10pt;
  2716. }
  2717. }
  2718. .column-vendor {
  2719. vertical-align: top;
  2720. }
  2721. .column-form-label {
  2722. width: 40%;
  2723. }
  2724. .column-form-value {
  2725. width: 60%;
  2726. }
  2727. }
  2728. .product-table-separator {
  2729. width: 100%;
  2730. margin: 15pt auto 10pt;
  2731. height: 2pt;
  2732. background-color: $bgColor;
  2733. }
  2734. .product-table {
  2735. table {
  2736. margin: 0 auto 6pt;
  2737. width: 100%;
  2738. border-radius: 6pt;
  2739. text-align: left;
  2740. }
  2741. tr:nth-of-type(n + 1) td {
  2742. border-top: 1pt solid #eee;
  2743. }
  2744. th {
  2745. background-color: $bgColor;
  2746. min-width: 20pt;
  2747. padding: 0 2pt;
  2748. }
  2749. td {
  2750. min-width: 20pt;
  2751. max-width: 100pt;
  2752. padding: 0 2pt;
  2753. white-space: pre-wrap;
  2754. .product-name {
  2755. font-weight: bold;
  2756. }
  2757. .desc {
  2758. white-space: pre-wrap;
  2759. line-height: 16pt;
  2760. color: $subColor;
  2761. }
  2762. }
  2763. .row-index {
  2764. width: 20pt;
  2765. }
  2766. }
  2767. .note-form-area {
  2768. width: 40%;
  2769. .label {
  2770. color: $subColor;
  2771. display: inline-block;
  2772. width: 40%;
  2773. vertical-align: top;
  2774. }
  2775. .value {
  2776. color: $subColor;
  2777. width: 60%;
  2778. word-break: break-word;
  2779. white-space: pre-wrap;
  2780. display: inline-block;
  2781. line-height: 16pt;
  2782. }
  2783. }
  2784. .sub-form-title {
  2785. color: $subColor;
  2786. font-weight: bold;
  2787. }
  2788. .signature-area {
  2789. color: $subColor;
  2790. .first-party {
  2791. padding: 30pt 0 0;
  2792. }
  2793. .second-party {
  2794. padding: 20pt 0 40pt;
  2795. }
  2796. }
  2797. }
  2798. .preview-area2 {
  2799. background-color: #fff;
  2800. .supplier-name {
  2801. font-size: 22pt;
  2802. text-align: center;
  2803. }
  2804. .billing-addr {
  2805. line-height: 18pt;
  2806. min-height: 18pt;
  2807. font-size: 12pt;
  2808. text-align: center;
  2809. }
  2810. .contact-info {
  2811. margin-bottom: 12pt;
  2812. min-height: 18pt;
  2813. line-height: 18pt;
  2814. font-size: 12pt;
  2815. }
  2816. .product-table {
  2817. table {
  2818. border: 1px solid $bgColor;
  2819. border-radius: 3pt;
  2820. margin: 0 auto 6pt;
  2821. width: 100%;
  2822. font-size: 10pt;
  2823. }
  2824. th {
  2825. text-align: left;
  2826. }
  2827. td {
  2828. white-space: pre-wrap;
  2829. }
  2830. th,
  2831. td {
  2832. padding: 4pt 6pt;
  2833. &:nth-of-type(n + 2) {
  2834. border-left: 1px solid $bgColor;
  2835. }
  2836. }
  2837. tr:nth-of-type(n + 2) {
  2838. td {
  2839. border-top: 1px solid $bgColor;
  2840. }
  2841. }
  2842. }
  2843. .table-title {
  2844. text-align: center;
  2845. font-weight: bold;
  2846. font-size: 16pt;
  2847. margin: 12pt auto 8pt;
  2848. }
  2849. .base-info-area {
  2850. margin-top: 12pt;
  2851. font-size: 11pt;
  2852. .base-info-label {
  2853. min-width: 90pt;
  2854. width: 90pt;
  2855. font-family: serif;
  2856. }
  2857. .base-info-value {
  2858. white-space: pre-wrap;
  2859. vertical-align: top;
  2860. flex: auto;
  2861. text-align: left;
  2862. font-family: sans-serif;
  2863. font-weight: 400;
  2864. }
  2865. .left {
  2866. padding-right: 8pt;
  2867. .base-info-label {
  2868. min-width: 60pt;
  2869. width: 60pt;
  2870. }
  2871. }
  2872. .right {
  2873. padding-left: 8pt;
  2874. }
  2875. .left,
  2876. .right {
  2877. width: 50%;
  2878. margin-bottom: 12pt;
  2879. }
  2880. }
  2881. .bank-info-area {
  2882. font-family: sans-serif;
  2883. font-weight: bold;
  2884. font-size: 11pt;
  2885. margin-bottom: 10pt;
  2886. .bank-info-label {
  2887. font-weight: bold;
  2888. font-family: serif;
  2889. width: 160pt;
  2890. max-width: 160pt;
  2891. }
  2892. .bank-info-value {
  2893. font-family: serif;
  2894. font-weight: normal;
  2895. }
  2896. }
  2897. }
  2898. @media print {
  2899. .screen {
  2900. display: none;
  2901. }
  2902. .preview-area,
  2903. .preview-area2 {
  2904. border: none;
  2905. border-color: transparent;
  2906. }
  2907. }
  2908. @media screen {
  2909. .print.hidden {
  2910. position: fixed;
  2911. right: -10000px;
  2912. bottom: -10000px;
  2913. }
  2914. .pdf-wrap {
  2915. position: relative;
  2916. width: 21cm;
  2917. margin: 0 auto;
  2918. box-shadow: 1px 1px 2pt 0px $subColor;
  2919. & + .pdf-wrap {
  2920. margin-top: 20px;
  2921. }
  2922. }
  2923. .preview-area,
  2924. .preview-area2 {
  2925. padding: 1cm;
  2926. min-height: 29.69cm;
  2927. }
  2928. }
  2929. </style>