baseForm.vue 48 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445
  1. <template>
  2. <el-form
  3. :model="ruleForm"
  4. status-icon
  5. :rules="rules"
  6. ref="ruleForm"
  7. :size="'mini'"
  8. v-loading="loading"
  9. label-width="85px"
  10. class="demo-ruleForm"
  11. >
  12. <el-row>
  13. <el-row>
  14. <el-col :span="12">
  15. <el-form-item label="客户名称" prop="companyName">
  16. <el-input
  17. placeholder="客户名称"
  18. maxlength="100"
  19. :disabled="type === 'view'"
  20. v-model="ruleForm.companyName"
  21. />
  22. </el-form-item>
  23. </el-col>
  24. <el-col :span="6">
  25. <el-form-item label="总数量" prop="num">
  26. <el-input placeholder="总数量" :disabled="type === 'view'" v-model="ruleForm.num" />
  27. </el-form-item>
  28. </el-col>
  29. <el-col :span="6">
  30. <el-form-item label="总价" class="clear">
  31. <el-input disabled :value="Number(total).toFixed(2)" />
  32. </el-form-item>
  33. </el-col>
  34. </el-row>
  35. <el-row>
  36. <el-col :span="12">
  37. <el-form-item label="业务公司" prop="customerCode">
  38. <search-work-company
  39. :disabled="true"
  40. :value="ruleForm.customerCode"
  41. :names="ruleForm.customerName"
  42. :placeholder="'业务公司'"
  43. :isDetail="true"
  44. :size="'mini'"
  45. @searchChange="company_idsearchChange"
  46. />
  47. </el-form-item>
  48. <el-form-item label="供应商" prop="supplierNo">
  49. <search-supplier
  50. :isDetail="true"
  51. :value="ruleForm.supplierNo"
  52. :names="ruleForm.supplierName"
  53. :placeholder="'供应商'"
  54. :disabled="type === 'view'"
  55. :size="'mini'"
  56. @searchChange="supplierNosearchChange"
  57. />
  58. </el-form-item>
  59. <el-form-item label="供应商订单号" prop="plat_orderCode" label-width="120px">
  60. <el-input placeholder="供应商订单号" v-model="ruleForm.plat_orderCode" />
  61. </el-form-item>
  62. <el-form-item label="附件" prop="fill_url">
  63. <div v-if="ruleForm.fill_url" class="clearfix">
  64. <a :href="ruleForm.fill_url" download="比价凭证">点击下载</a>
  65. <el-link
  66. :underline="false"
  67. @click="ruleForm.fill_url = ''"
  68. type="warning"
  69. style="margin: 0 0 0 16px"
  70. >删除</el-link>
  71. </div>
  72. <div class="activity-upload" v-else>
  73. <div class="btnupload" style="position: relative">
  74. <i class="el-icon-plus avatar-uploader-icon"></i>
  75. <file-upload-pdf
  76. class="Upload"
  77. :accept="'.xlsx,.xls,.pdf,.zip,.rar,.7z'"
  78. :multiple="false"
  79. :uploadcondition="beforeOtherUpload"
  80. @UploadErrorEvent="UploadErrorOtherproof_url"
  81. @UploadSuccessEvent="UploadSuccessOtherproof_url"
  82. />
  83. </div>
  84. <div class="txt-tips fl">
  85. <p>建议大小:小于5MB</p>
  86. <p>文件格式:.xlsx,.xls,.pdf,.zip,.rar,.7z</p>
  87. </div>
  88. </div>
  89. </el-form-item>
  90. </el-col>
  91. <el-col :span="12">
  92. <el-row>
  93. <el-col :span="7">
  94. <el-form-item prop="is_determine_price" label="确定" label-width="60px">
  95. <el-select
  96. v-model="ruleForm.is_determine_price"
  97. style="width: 100%"
  98. :disabled="type === 'view'"
  99. >
  100. <el-option value="1" label="销售单价" />
  101. <el-option value="0" label="采购裸价" />
  102. </el-select>
  103. </el-form-item>
  104. </el-col>
  105. <el-col :span="10">
  106. <el-form-item
  107. label="采购裸价"
  108. prop="cgd_charge"
  109. v-if="ruleForm.is_determine_price === '0'"
  110. class="clear"
  111. label-width="100px"
  112. >
  113. <digital-input
  114. :values="ruleForm.cgd_charge"
  115. :placeholder="'采购裸价'"
  116. :min="0"
  117. :disabled="
  118. type === 'view' || is_noble || ruleForm.is_determine_price === '1'
  119. "
  120. :max="100000000000"
  121. :position="'right'"
  122. :precision="2"
  123. :size="'mini'"
  124. :controls="false"
  125. :append="'元'"
  126. @reschange="number_change($event, 'cgd_charge')"
  127. />
  128. </el-form-item>
  129. <el-form-item
  130. label="销售单价"
  131. v-if="ruleForm.is_determine_price === '1'"
  132. prop="price"
  133. label-width="100px"
  134. >
  135. <digital-input
  136. :values="ruleForm.price"
  137. :placeholder="'销售单价'"
  138. :min="0"
  139. :disabled="
  140. type === 'view' || is_noble || ruleForm.is_determine_price === '0'
  141. "
  142. :readonly="ruleForm.is_determine_price === '0'"
  143. :max="100000000000"
  144. :position="'right'"
  145. :precision="2"
  146. :size="'mini'"
  147. :controls="false"
  148. :append="'元'"
  149. @reschange="number_change($event, 'price')"
  150. />
  151. </el-form-item>
  152. </el-col>
  153. <el-col :span="7">
  154. <el-form-item :label="ruleForm.is_determine_price === '1' ? '采购裸价' : '销售单价'">
  155. <el-input
  156. v-if="ruleForm.is_determine_price === '1'"
  157. :disabled="true"
  158. v-model="ruleForm.cgd_charge"
  159. :placeholder="'采购裸价'"
  160. />
  161. <el-input v-else :disabled="true" v-model="ruleForm.price" :placeholder="'销售单价'" />
  162. </el-form-item>
  163. </el-col>
  164. </el-row>
  165. <el-row>
  166. <el-col :span="7">
  167. <el-form-item prop="type" label="确定" label-width="60px">
  168. <el-select v-model="ruleForm.type" style="width: 100%" :disabled="type === 'view'">
  169. <el-option value="1" label="服务费金额" />
  170. <el-option value="0" label="服务费比例" />
  171. </el-select>
  172. </el-form-item>
  173. </el-col>
  174. <el-col :span="10">
  175. <el-form-item
  176. label="服务费比例"
  177. v-if="ruleForm.type === '0'"
  178. prop="expect_service_proportion"
  179. label-width="100px"
  180. >
  181. <digital-input
  182. :values="ruleForm.expect_service_proportion"
  183. :placeholder="'服务费比例'"
  184. :min="0"
  185. :disabled="type === 'view' || is_noble"
  186. :max="100000000000"
  187. :position="'right'"
  188. :precision="2"
  189. :size="'mini'"
  190. :controls="false"
  191. :append="'%'"
  192. @reschange="number_change($event, 'expect_service_proportion')"
  193. />
  194. </el-form-item>
  195. <el-form-item
  196. label="服务费金额"
  197. prop="expect_service"
  198. label-width="100px"
  199. v-if="ruleForm.type === '1'"
  200. >
  201. <digital-input
  202. :values="ruleForm.expect_service"
  203. :placeholder="'服务费金额'"
  204. :min="0"
  205. :disabled="type === 'view' || is_noble"
  206. :max="100000000000"
  207. :position="'right'"
  208. :precision="2"
  209. :size="'mini'"
  210. :controls="false"
  211. :append="'元'"
  212. @reschange="number_change($event, 'expect_service')"
  213. />
  214. </el-form-item>
  215. </el-col>
  216. <el-col :span="7">
  217. <el-form-item :label="ruleForm.type === '1' ? '服务费比例' : '服务费金额'">
  218. <el-input
  219. v-if="ruleForm.type === '1'"
  220. :disabled="true"
  221. v-model="ruleForm.expect_service_proportion"
  222. :placeholder="'服务费比例'"
  223. />
  224. <el-input
  225. v-else
  226. :disabled="true"
  227. v-model="ruleForm.expect_service"
  228. :placeholder="'服务费金额'"
  229. />
  230. </el-form-item>
  231. </el-col>
  232. <el-col :span="12">
  233. <el-form-item label="产地" prop="origin_place">
  234. <search-area
  235. :value="ruleForm.origin_place"
  236. :names="origin_place_cn"
  237. :is-detail="true"
  238. :disabled="type === 'view'"
  239. size="mini"
  240. :placeholder="'产地'"
  241. :level="3"
  242. @searchChange="selectAreaoriginChange($event)"
  243. />
  244. </el-form-item>
  245. </el-col>
  246. <el-col :span="12">
  247. <el-form-item label="发货地" prop="delivery_place">
  248. <search-area
  249. :value="ruleForm.delivery_place"
  250. :names="delivery_place_cn"
  251. :is-detail="true"
  252. :disabled="type === 'view'"
  253. size="mini"
  254. :placeholder="'发货地'"
  255. :level="3"
  256. @searchChange="selectAreadeliveryChange($event)"
  257. />
  258. </el-form-item>
  259. </el-col>
  260. <el-col :span="12">
  261. <el-form-item label="供货区域" prop="supply_area">
  262. <el-select
  263. v-model="ruleForm.supply_area"
  264. filterable
  265. :disabled="type === 'view'"
  266. clearable
  267. style="width: 100%"
  268. placeholder="供货区域"
  269. >
  270. <el-option
  271. v-for="group in options6"
  272. :key="group.id"
  273. :label="group.name"
  274. :value="group.id"
  275. />
  276. </el-select>
  277. </el-form-item>
  278. </el-col>
  279. <el-col :span="12">
  280. <el-form-item label="支付方式" prop="pay_way" class="clear">
  281. <el-select
  282. v-model="ruleForm.pay_way"
  283. filterable
  284. :disabled="type === 'view'"
  285. clearable
  286. style="width: 100%"
  287. placeholder="支付方式"
  288. >
  289. <el-option
  290. v-for="group in options10"
  291. :key="group.id"
  292. :label="group.name"
  293. :value="group.id"
  294. />
  295. </el-select>
  296. </el-form-item>
  297. </el-col>
  298. </el-row>
  299. </el-col>
  300. </el-row>
  301. <el-col :span="24">
  302. <el-row>
  303. <el-col :span="24">
  304. <el-form-item label="商品名称" prop="good_name">
  305. <el-input
  306. :disabled="type === 'view'"
  307. v-model="ruleForm.good_name"
  308. placeholder="商品名称"
  309. />
  310. </el-form-item>
  311. </el-col>
  312. <el-col :span="16">
  313. <el-row>
  314. <el-col :span="14">
  315. <el-form-item label="分类" prop="cat_id">
  316. <company-sort
  317. :value="ruleForm.cat_id"
  318. :placeholder="'分类'"
  319. :size="'mini'"
  320. :names="ruleForm.cat_id_name"
  321. :disabled="type === 'view' || ruleForm.customerCode.length === 0"
  322. :company-no="ruleForm.customerCode"
  323. :isDetail="true"
  324. @searchChange="cat_id_change"
  325. />
  326. </el-form-item>
  327. </el-col>
  328. <el-col :span="10">
  329. <el-form-item label="品牌" prop="brand_id">
  330. <search-brand
  331. :value="ruleForm.brand_id"
  332. :size="'mini'"
  333. :disabled="type === 'view'"
  334. :isDetail="true"
  335. :names="ruleForm.brand_name"
  336. :placeholder="'品牌'"
  337. @searchChange="brand_idsearchChange"
  338. />
  339. </el-form-item>
  340. </el-col>
  341. <el-col :span="24">
  342. <el-row>
  343. <el-col :span="7">
  344. <el-form-item label="单位" prop="unit_id">
  345. <search-unit
  346. :value="ruleForm.unit_id"
  347. :size="'mini'"
  348. :isDetail="true"
  349. :names="ruleForm.unit_name"
  350. :disabled="type === 'view'"
  351. :placeholder="'单位'"
  352. @searchChange="unitsearchChange"
  353. />
  354. </el-form-item>
  355. </el-col>
  356. <el-col :span="7">
  357. <el-form-item label="税点" prop="tax">
  358. <search-tax
  359. :value="ruleForm.tax"
  360. :size="'mini'"
  361. :disabled="type === 'view'"
  362. :isDetail="type !== 'add'"
  363. :placeholder="'税点'"
  364. @searchChange="taxsearchChange"
  365. />
  366. </el-form-item>
  367. </el-col>
  368. <el-col :span="10">
  369. <el-form-item label="总重量" prop="weight">
  370. <digital-input
  371. :values="ruleForm.weight"
  372. :placeholder="'总重量'"
  373. :min="0"
  374. :max="100000000000"
  375. :position="'right'"
  376. :precision="3"
  377. :disabled="type === 'view'"
  378. :size="'mini'"
  379. :controls="false"
  380. :append="'g'"
  381. @reschange="number_change($event, 'weight')"
  382. />
  383. </el-form-item>
  384. </el-col>
  385. </el-row>
  386. </el-col>
  387. <el-col :span="7">
  388. <el-form-item label="有效期" prop="preservation_day">
  389. <digital-input
  390. :values="ruleForm.preservation_day"
  391. :placeholder="'有效期'"
  392. :min="1"
  393. :max="100000000000"
  394. :position="'right'"
  395. :precision="0"
  396. :size="'mini'"
  397. :disabled="type === 'view'"
  398. :controls="false"
  399. :append="'天'"
  400. @reschange="number_change($event, 'preservation_day')"
  401. />
  402. </el-form-item>
  403. </el-col>
  404. <el-col :span="7">
  405. <el-form-item label="物流时间" prop="delivery_day">
  406. <digital-input
  407. :values="ruleForm.delivery_day"
  408. :placeholder="'物流时间'"
  409. :min="0"
  410. :max="100000000000"
  411. :position="'right'"
  412. :precision="0"
  413. :size="'mini'"
  414. :disabled="type === 'view'"
  415. :controls="false"
  416. :append="'天'"
  417. @reschange="number_change($event, 'delivery_day')"
  418. />
  419. </el-form-item>
  420. </el-col>
  421. <el-col :span="10">
  422. <el-form-item label="生产工期" prop="make_day">
  423. <digital-input
  424. :values="ruleForm.make_day"
  425. :placeholder="'生产工期'"
  426. :min="0"
  427. :max="100000000000"
  428. :disabled="type === 'view'"
  429. :position="'right'"
  430. :precision="0"
  431. :size="'mini'"
  432. :controls="false"
  433. :append="'天'"
  434. @reschange="number_change($event, 'make_day')"
  435. />
  436. </el-form-item>
  437. </el-col>
  438. <el-col :span="24">
  439. <el-form-item label="采购备注" prop="remark">
  440. <el-input
  441. placeholder="采购备注"
  442. maxlength="500"
  443. :disabled="type === 'view'"
  444. v-model="ruleForm.remark"
  445. ></el-input>
  446. </el-form-item>
  447. <el-form-item label="工艺说明" prop="cost_desc">
  448. <el-input
  449. placeholder="工艺说明"
  450. maxlength="500"
  451. :disabled="type === 'view'"
  452. v-model="ruleForm.cost_desc"
  453. ></el-input>
  454. </el-form-item>
  455. </el-col>
  456. </el-row>
  457. </el-col>
  458. <el-col :span="8" style="padding: 0 0 0 15px">
  459. <el-table
  460. :data="spec_tableData"
  461. :size="'mini'"
  462. border
  463. style="width: 100%"
  464. height="215px"
  465. max-height="215px"
  466. >
  467. <el-table-column prop="spec_name" label="规格类型" />
  468. <el-table-column prop="spec_value_name" label="规格值" />
  469. <el-table-column fixed="right" width="88px" v-if="type !== 'view'">
  470. <template slot="header" slot-scope="scope">
  471. <span>操作</span>
  472. <el-tooltip class="item" effect="dark" content="添加规格类型" placement="top">
  473. <i
  474. class="el-icon-circle-plus-outline fr"
  475. style="font-size: 18px; margin-top: 2px"
  476. @click="openEdit('-1', {})"
  477. />
  478. </el-tooltip>
  479. </template>
  480. <template slot-scope="scope">
  481. <el-tooltip effect="dark" content="修改" placement="top">
  482. <i class="el-icon-edit tb-icon" @click="openEdit(scope.$index, scope.row)"></i>
  483. </el-tooltip>
  484. <el-tooltip effect="dark" v-if="!scope.row.isMust" placement="top">
  485. <i class="el-icon-delete tb-icon" @click="openDelete(scope.$index)"></i>
  486. </el-tooltip>
  487. </template>
  488. </el-table-column>
  489. </el-table>
  490. <!-- 弹窗 新增/修改 -->
  491. <base-form-add-edit
  492. :index="modelIndex"
  493. :show-model="showOtherModel"
  494. :sitem="modelSitem"
  495. @refresh="refreshEdit"
  496. @cancel="showOtherModel = false"
  497. />
  498. </el-col>
  499. </el-row>
  500. </el-col>
  501. </el-row>
  502. <el-row v-if="is_noble">
  503. <el-col :span="6">
  504. <el-form-item label="金属重量" prop="gold_weight">
  505. <digital-input
  506. :values="ruleForm.gold_weight"
  507. :placeholder="'金属重量'"
  508. :min="0"
  509. :disabled="type === 'view'"
  510. :max="100000000000"
  511. :position="'right'"
  512. :precision="3"
  513. :size="'mini'"
  514. :controls="false"
  515. :append="'g'"
  516. @reschange="number_change($event, 'gold_weight')"
  517. />
  518. </el-form-item>
  519. </el-col>
  520. <el-col :span="6">
  521. <el-form-item label="金属种类" prop="noble_metal">
  522. <search-metal-kind
  523. :value="ruleForm.noble_metal"
  524. :size="'mini'"
  525. :disabled="type === 'view'"
  526. :isDetail="true"
  527. :placeholder="'金属种类'"
  528. @searchChange="noble_metalsearchChange"
  529. />
  530. </el-form-item>
  531. </el-col>
  532. <el-col :span="12">
  533. <el-form-item label="配置要求" prop="config">
  534. <el-select
  535. v-model="ruleForm.config"
  536. multiple
  537. :disabled="type === 'view'"
  538. style="width: 100%"
  539. placeholder="配置要求"
  540. >
  541. <el-option
  542. v-for="(item, index) in options9"
  543. :key="item + index"
  544. :label="item"
  545. :value="item"
  546. />
  547. </el-select>
  548. </el-form-item>
  549. </el-col>
  550. <el-col :span="24">
  551. <el-form-item label="其他配置要求" prop="other_config" label-width="120px">
  552. <el-input
  553. placeholder="其他要求"
  554. maxlength="100"
  555. :disabled="type === 'view'"
  556. v-model="ruleForm.other_config"
  557. ></el-input>
  558. </el-form-item>
  559. </el-col>
  560. </el-row>
  561. <el-row :span="24">
  562. <el-form-item
  563. label="商品图片(<1mb)"
  564. prop="good_img"
  565. v-if="ruleForm.good_img"
  566. class="activity-upload"
  567. >
  568. <div
  569. class="btnupload"
  570. style="position: relative; margin-left: 10px"
  571. v-for="(item, index) in ruleForm.good_img"
  572. :key="index"
  573. >
  574. <img :src="ruleForm.good_img[index]" class="avatar" />
  575. <i
  576. v-if="type == 'add' || type === 'editBase' || type === 'edit'"
  577. class="el-icon-close"
  578. @click="closeImg(index, 'good_img')"
  579. ></i>
  580. </div>
  581. <div v-if="type == 'view' ? false : true">
  582. <i
  583. class="el-icon-plus avatar-uploader-icon"
  584. style="position: relative; width: 50px; height: 50px"
  585. >
  586. <file-upload
  587. class="Upload"
  588. :accept="'.jpg,.png,.jpeg'"
  589. :multiple="true"
  590. :disabled="type === 'view'"
  591. :uploadcondition="beforeAvatarUpload"
  592. @UploadErrorEvent="UploadErrorEventgood_img"
  593. @UploadSuccessEvent="UploadSuccessEventgood_img"
  594. ></file-upload>
  595. </i>
  596. </div>
  597. </el-form-item>
  598. </el-row>
  599. <el-form-item v-if="type !== 'view'">
  600. <div style="width: 100%; display: flex; justify-content: flex-end">
  601. <el-button type="primary" @click="submitForm">保存</el-button>
  602. </div>
  603. </el-form-item>
  604. </el-form>
  605. </template>
  606. <script>
  607. import asyncRequest from "@/apis/service/sellOut/filing";
  608. import resToken from "@/mixins/resToken";
  609. import { mapGetters } from "vuex";
  610. import baseFormAddEdit from "./baseFormAddEdit";
  611. import { add_sum, accMul, accDiv, accSub } from "@/utils/validate";
  612. import companyHelper from "@/mixins/companyHelper";
  613. import {
  614. rules,
  615. options1,
  616. options2,
  617. options3,
  618. options4,
  619. options5,
  620. options6,
  621. options7,
  622. options8,
  623. options9,
  624. options10,
  625. options11,
  626. ruleForm1,
  627. other_ruleForm
  628. } from "../config/columns";
  629. export default {
  630. name: "goodsCostAdd",
  631. mixins: [resToken, companyHelper],
  632. props: ["showModel", "id", "type", "sitem", "askItem", "newTime", "editId"],
  633. components: {
  634. baseFormAddEdit
  635. },
  636. computed: {
  637. ...mapGetters(["tablebtnSize", "searchSize", "size", "business_companyNo"]),
  638. powers() {
  639. const tran =
  640. this.$store.getters.btnList.find(
  641. item => item.menu_route == "goodsCostAdd"
  642. ) || {};
  643. const { action } = tran ?? {};
  644. return action ?? [];
  645. },
  646. total() {
  647. const { is_determine_price, expect_service, num } = this.ruleForm;
  648. const prop = is_determine_price === "1" ? "price" : "cgd_charge";
  649. return accMul(add_sum(this.ruleForm[prop], expect_service), num);
  650. }
  651. },
  652. watch: {
  653. newTime: function(val) {
  654. if (val) {
  655. this.initForm();
  656. }
  657. }
  658. },
  659. data() {
  660. return {
  661. origin_place_cn: "",
  662. delivery_place_cn: "",
  663. supplierName: [],
  664. pid: "",
  665. cat_id_name: "",
  666. // supplierNo: "",
  667. brand_name: "",
  668. unit_name: "",
  669. title: "",
  670. modelIndex: "",
  671. modelSitem: {},
  672. spec_tableData: [],
  673. companyList: [],
  674. showOtherModel: false,
  675. is_noble: false,
  676. status: "",
  677. rulesThis: this.rules,
  678. activeName: "1",
  679. loading: true,
  680. supplierName: "",
  681. //新实时金价
  682. newGoldPrice: 0,
  683. options1: options1,
  684. options2: options2,
  685. options3: options3,
  686. options4: options4,
  687. options5: options5,
  688. options6: options6,
  689. options7: options7,
  690. options8: options8,
  691. options9: options9,
  692. options10: options10,
  693. options11: options11,
  694. ruleForm: { ...ruleForm1 },
  695. rules,
  696. //成本合算
  697. newPrice: 0
  698. };
  699. },
  700. mounted() {
  701. this.initForm();
  702. },
  703. methods: {
  704. // 其他文件上传成功
  705. async UploadSuccessOtherproof_url(data) {
  706. const { url } = data;
  707. if (url === "noToken") {
  708. await this.logout();
  709. } else {
  710. this.ruleForm.fill_url = url;
  711. this.$message.success("文件成功!");
  712. }
  713. },
  714. //其他文件上传失败
  715. UploadErrorOtherproof_url(res) {
  716. if (res !== "break") {
  717. this.set_proof_url();
  718. this.$message.error("文件上传失败!");
  719. }
  720. },
  721. //判断其他文件规格
  722. beforeOtherUpload(file) {
  723. let isJPG = false;
  724. if (
  725. file.type === "application/vnd.ms-excel" ||
  726. file.type ===
  727. "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ||
  728. file.type === "application/pdf" ||
  729. file.type === "application/x-zip-compressed"
  730. ) {
  731. isJPG = true;
  732. }
  733. let name = file.name;
  734. let list = name.split(".");
  735. if (list[list.length - 1] === "rar" || list[list.length - 1] === "7z") {
  736. isJPG = true;
  737. }
  738. const isLt2M = file.size / 1024 / 1024 < 5;
  739. if (!isJPG) {
  740. this.$message.error("文件格式不正确!");
  741. }
  742. if (!isLt2M) {
  743. this.$message.error("文件大小不能超过 5MB!");
  744. }
  745. return isJPG && isLt2M;
  746. },
  747. //图片悬浮删除
  748. closeImg(index, key) {
  749. this.ruleForm[key].splice(index, 1);
  750. this.$refs.ruleForm.validateField(key);
  751. },
  752. async initForm() {
  753. this.loading = true;
  754. this.rulesThis = this.rules;
  755. await this.resetForm();
  756. this.loading = false;
  757. },
  758. number_change(e, key) {
  759. this.ruleForm[key] = e + "" || "0";
  760. const { is_determine_price, type } = this.ruleForm;
  761. if (key === "price" && String(is_determine_price) == "1") {
  762. this.getPrice(key);
  763. } else if (key === "cgd_charge" && String(is_determine_price) == "0") {
  764. this.getPrice(key);
  765. } else if (key === "expect_service" && String(type) == "1") {
  766. this.getPrice(key);
  767. } else if (key === "expect_service_proportion" && String(type) == "0") {
  768. this.getProp();
  769. } else if (key === "num") {
  770. this.getTotal();
  771. }
  772. if (this.$refs && this.$refs.ruleForm) {
  773. this.$refs.ruleForm.validateField(key);
  774. }
  775. },
  776. //计算单价
  777. getPrice(key) {
  778. const { is_determine_price, type } = this.ruleForm;
  779. if(String(type) == "1" && key === "expect_service"){
  780. this.ruleForm.price = Number(add_sum(this.ruleForm.cgd_charge,this.ruleForm.expect_service) || 0).toFixed(2)
  781. this.ruleForm.expect_service_proportion = accMul(
  782. this.ruleForm.cgd_charge ? accDiv(this.ruleForm.expect_service, this.ruleForm.cgd_charge) : "0",
  783. "100"
  784. ).toFixed(2);
  785. } else if ((key === "price" && String(is_determine_price) == "1")) {
  786. const Sub = accSub(
  787. Number(this.ruleForm.price),
  788. Number(this.ruleForm.expect_service)
  789. );
  790. this.ruleForm.cgd_charge = Number(Number(Sub) < 0 ? 0 : Sub).toFixed(2);
  791. const cgd_charge = Number(this.ruleForm.cgd_charge);
  792. this.ruleForm.expect_service_proportion = accMul(
  793. cgd_charge ? accDiv(this.ruleForm.expect_service, cgd_charge) : "0",
  794. "100"
  795. ).toFixed(2);
  796. } else if (
  797. (key === "cgd_charge" && String(is_determine_price) == "0") ||
  798. (String(type) == "0" && key === "expect_service")
  799. ) {
  800. this.ruleForm.price = add_sum(
  801. this.ruleForm.cgd_charge,
  802. this.ruleForm.expect_service
  803. ).toFixed(2);
  804. const cgd_charge = Number(this.ruleForm.cgd_charge);
  805. this.ruleForm.expect_service_proportion = accMul(
  806. cgd_charge ? accDiv(this.ruleForm.expect_service, cgd_charge) : "0",
  807. "100"
  808. ).toFixed(2);
  809. } else {
  810. console.log(3333);
  811. }
  812. this.getTotal();
  813. },
  814. //计算比例
  815. getProp() {
  816. const { is_determine_price, expect_service_proportion } = this.ruleForm;
  817. if (String(is_determine_price) == "0") {
  818. this.ruleForm.expect_service = accMul(
  819. accDiv(expect_service_proportion, "100"),
  820. this.ruleForm.cgd_charge
  821. ).toFixed(2);
  822. this.ruleForm.price = add_sum(
  823. this.ruleForm.expect_service,
  824. this.ruleForm.cgd_charge
  825. ).toFixed(2);
  826. } else if (String(is_determine_price) == "1") {
  827. const c1 = accMul(expect_service_proportion, this.ruleForm.price);
  828. const c2 = add_sum(expect_service_proportion, "100");
  829. this.ruleForm.expect_service = accDiv(c1, c2).toFixed(2);
  830. this.ruleForm.cgd_charge = Number(accSub(
  831. this.ruleForm.price,
  832. this.ruleForm.expect_service
  833. )).toFixed(2);
  834. }
  835. this.getTotal();
  836. },
  837. //计算总价
  838. getTotal() {
  839. const { num, price } = this.ruleForm;
  840. this.ruleForm.total = accMul(num, price).toFixed(2);
  841. },
  842. async set_must_spec() {
  843. const { cat_id } = this.ruleForm;
  844. let id = cat_id.length == 1 ? cat_id[0] : "";
  845. if (id) {
  846. const { code, message, data } = await asyncRequest.catinfo({ id: id });
  847. if (code === 0) {
  848. const { spec } = data;
  849. if (spec && spec.length > 0) {
  850. if (this.spec_tableData && this.spec_tableData.length > 0) {
  851. this.spec_tableData.forEach(c => {
  852. c.isMust = false;
  853. });
  854. spec.forEach((a, ai) => {
  855. let findex = this.spec_tableData.findIndex(
  856. b => b.specid === a.id
  857. );
  858. if (findex !== -1) {
  859. this.spec_tableData[findex].isMust = true;
  860. } else {
  861. this.spec_tableData.push({
  862. id: "",
  863. index: "1",
  864. specid: a.id,
  865. spec_name: a.spec_name,
  866. isMust: true,
  867. spec_value_name: "",
  868. spec_value_id: ""
  869. });
  870. }
  871. });
  872. } else {
  873. spec.forEach((a, ai) => {
  874. let model = {
  875. id: "",
  876. index: "1",
  877. specid: a.id,
  878. spec_name: a.spec_name,
  879. isMust: true,
  880. spec_value_name: "",
  881. spec_value_id: ""
  882. };
  883. this.spec_tableData.push(model);
  884. });
  885. }
  886. }
  887. this.spec_tableData.map((e, ei) => {
  888. e.index = ei + "";
  889. return e;
  890. });
  891. this.spec_tableData.forEach((si, sii) => {
  892. this.$set(this.spec_tableData, sii, si);
  893. });
  894. } else if (code >= 100 && code <= 104) {
  895. await this.logout();
  896. } else {
  897. this.$message.warning(message);
  898. }
  899. } else {
  900. this.spec_tableData.forEach((si, sii) => {
  901. si.isMust = false;
  902. this.$set(this.spec_tableData, sii, si);
  903. });
  904. }
  905. },
  906. async submitForm() {
  907. try {
  908. await this.$refs.ruleForm.validate();
  909. if (!this.loading) {
  910. this.loading = true;
  911. if (this.ruleForm.good_img.length > 10) {
  912. this.$message.warning("上传图片不能超过10张");
  913. this.loading = false;
  914. return;
  915. }
  916. if (this.spec_tableData.length === 0) {
  917. this.$message.warning("请填写规格!");
  918. this.loading = false;
  919. return;
  920. }
  921. if (this.is_noble) {
  922. this.ruleForm.cgd_charge = "0";
  923. }
  924. const {
  925. is_determine_price,
  926. expect_service,
  927. expect_service_proportion
  928. } = this.ruleForm;
  929. const prop = is_determine_price === "1" ? "price" : "cgd_charge";
  930. const label = is_determine_price === "1" ? "销售价" : "裸价";
  931. if (!Number(this.ruleForm[prop]) && !this.is_noble) {
  932. this.$message.warning(label + "不能为空");
  933. this.loading = false;
  934. return;
  935. }
  936. if (
  937. !Number(expect_service) &&
  938. !Number(expect_service_proportion) &&
  939. !this.is_noble
  940. ) {
  941. this.$message.warning("服务费比例和服务费不能同时为空");
  942. this.loading = false;
  943. return;
  944. }
  945. // //没有服务费存在服务费比例 重新计算服务费
  946. // if (!Number(expect_service) && Number(expect_service_proportion)) {
  947. // this.handleProportionrChange(expect_service_proportion);
  948. // }
  949. //
  950. // //没有服务费存在服务费比例或者两个都存在 以服务费计算服务费比例
  951. // if (
  952. // (!Number(expect_service_proportion) && Number(expect_service)) ||
  953. // (Number(expect_service_proportion) && Number(expect_service))
  954. // ) {
  955. // this.handleExpectChange(expect_service);
  956. // }
  957. let model = Object.assign(
  958. other_ruleForm,
  959. JSON.parse(JSON.stringify(this.ruleForm))
  960. );
  961. model.cat_id = model.cat_id[model.cat_id.length - 1];
  962. model.brand_id = model.brand_id.toString();
  963. model.origin_place = model.originPlace;
  964. model.delivery_place = model.deliveryPlace;
  965. model.unit_id = model.unit_id.toString();
  966. model.config = model.config.toString();
  967. model.tax = parseInt(model.tax + "") + "";
  968. model.spec_list = [];
  969. model.supplierNo = model.supplierNo.toString();
  970. delete model.originPlace;
  971. let list = JSON.parse(JSON.stringify(this.spec_tableData));
  972. list.forEach(a => {
  973. let am = {
  974. spec_id: a.specid,
  975. spec_value_id: a.spec_value_id
  976. };
  977. model.spec_list.push(am);
  978. });
  979. let res = {};
  980. if (this.type === "add") {
  981. res = await asyncRequest.add({
  982. ...model,
  983. });
  984. } else {
  985. res = await asyncRequest.update({
  986. ...model,
  987. });
  988. }
  989. const { code } = await this.useResHandle(res);
  990. this.loading = false;
  991. if (code === 0) {
  992. const title = this.type === "add" ? "新建成功!" : "修改成功!";
  993. this.$notify.success({
  994. title: title,
  995. message: ""
  996. });
  997. this.showModelThis = false;
  998. this.$router.push("/sellOut/filing");
  999. }
  1000. }
  1001. } catch (err) {
  1002. console.log(err);
  1003. }
  1004. },
  1005. handleProportionrChange(e) {
  1006. if (this.$refs && this.$refs.ruleForm) {
  1007. this.ruleForm.expect_service_proportion = e;
  1008. this.$refs.ruleForm.validateField("expect_service_proportion");
  1009. const {
  1010. cgd_charge,
  1011. is_determine_price,
  1012. expect_service_proportion
  1013. } = this.ruleForm;
  1014. const prop = is_determine_price === "1" ? "price" : "cgd_charge";
  1015. if (!expect_service_proportion) return;
  1016. if (Number(this.ruleForm.expect_service_proportion) > 100) {
  1017. this.$message.warning("服务费比例不能大于100%");
  1018. this.ruleForm.expect_service = "";
  1019. this.ruleForm.expect_service_proportion = "";
  1020. return;
  1021. }
  1022. this.ruleForm.expect_service =
  1023. Number(this.ruleForm[prop]) === 0 || !this.ruleForm[prop]
  1024. ? "0"
  1025. : accMul(
  1026. accDiv(expect_service_proportion, 100),
  1027. this.ruleForm[prop]
  1028. );
  1029. this.$refs.ruleForm.validate("expect_service");
  1030. this.$forceUpdate();
  1031. }
  1032. },
  1033. handleExpectChange(e) {
  1034. if (this.$refs && this.$refs.ruleForm) {
  1035. this.ruleForm.expect_service = e;
  1036. this.$refs.ruleForm.validateField("expect_service");
  1037. const {
  1038. price,
  1039. cgd_charge,
  1040. is_determine_price,
  1041. expect_service
  1042. } = this.ruleForm;
  1043. if (!expect_service) return;
  1044. const prop = is_determine_price === "1" ? "price" : "cgd_charge";
  1045. const label = is_determine_price === "1" ? "销售价" : "裸价";
  1046. if (Number(expect_service) > Number(this.ruleForm[prop])) {
  1047. this.$message.warning("服务费不能大于" + label);
  1048. this.ruleForm.expect_service = "";
  1049. this.ruleForm.expect_service_proportion = "";
  1050. return;
  1051. }
  1052. this.ruleForm.expect_service_proportion =
  1053. Number(this.ruleForm[prop]) === 0 || !this.ruleForm[prop]
  1054. ? "0"
  1055. : accMul(accDiv(expect_service, this.ruleForm[prop]), 100);
  1056. this.$refs.ruleForm.validate("expect_service_proportion");
  1057. this.$forceUpdate();
  1058. }
  1059. },
  1060. async resetForm() {
  1061. // 重置
  1062. await this.$nextTick(async () => {
  1063. if (this.$refs && this.$refs.ruleForm) {
  1064. this.$refs.ruleForm.resetFields();
  1065. this.$refs.ruleForm.clearValidate();
  1066. this.spec_tableData = [];
  1067. this.is_noble = false;
  1068. if (this.type === "add") {
  1069. this.ruleForm.customerCode = this.currentCompany;
  1070. this.$nextTick(() => {
  1071. this.ruleForm.preservation_day = 1;
  1072. });
  1073. } else if (this.type === "edit") {
  1074. this.loading = true;
  1075. const { code, data } = await asyncRequest.detail({
  1076. id: this.$route.query.id
  1077. });
  1078. this.loading = false;
  1079. if (code !== 0) return;
  1080. const {
  1081. id,
  1082. companyName,
  1083. num,
  1084. is_determine_price,
  1085. customerCode,
  1086. customerName,
  1087. supplierName,
  1088. supplierNo,
  1089. cgd_charge,
  1090. price,
  1091. service_charge,
  1092. service_proportion,
  1093. good_name,
  1094. cat_info,
  1095. brand_name,
  1096. brand_id,
  1097. unit_id,
  1098. unit_name,
  1099. tax,
  1100. weight,
  1101. preservation_day,
  1102. delivery_day,
  1103. make_day,
  1104. origin_place,
  1105. delivery_place,
  1106. origin_place_cn,
  1107. delivery_place_cn,
  1108. supply_area,
  1109. pay_way,
  1110. remark,
  1111. cost_desc,
  1112. good_img,
  1113. specinfo,
  1114. fill_url,
  1115. expect_service,
  1116. noble_metal,
  1117. config,
  1118. gold_weight,
  1119. other_config,
  1120. plat_orderCode
  1121. } = data;
  1122. if (Number(gold_weight) !== 0) {
  1123. this.is_noble = true;
  1124. }
  1125. this.ruleForm = {
  1126. ...ruleForm1,
  1127. plat_orderCode:plat_orderCode || "",
  1128. other_config: other_config || "",
  1129. gold_weight: gold_weight || "",
  1130. noble_metal: noble_metal || "",
  1131. config: config ? config.split(",") : [],
  1132. expect_service: expect_service || "",
  1133. id: id || "",
  1134. fill_url: fill_url || "",
  1135. is_determine_price: is_determine_price || "",
  1136. companyName: companyName || "",
  1137. num: num || "",
  1138. customerCode: customerCode || "",
  1139. customerName: customerName || "",
  1140. supplierName: supplierName || "",
  1141. supplierNo: supplierNo ? [supplierNo] : "",
  1142. cgd_charge: cgd_charge || "",
  1143. service_charge: service_charge || "",
  1144. service_proportion: service_proportion || "",
  1145. cat_id: cat_info ? [cat_info[cat_info.length - 1].id] : "",
  1146. cat_id_name: cat_info
  1147. .map(({ name }, index) => (index === 0 ? name : `_${name}`))
  1148. .join(""),
  1149. good_name: good_name || "",
  1150. price: price || "",
  1151. brand_name: brand_name ? [brand_name] : "",
  1152. brand_id: brand_id ? [brand_id] : "",
  1153. unit_id: unit_id ? [unit_id] : "",
  1154. unit_name: unit_name ? [unit_name] : "",
  1155. tax: tax ? `${tax}%` : "",
  1156. weight: weight || "",
  1157. preservation_day: preservation_day || "",
  1158. delivery_day: delivery_day || "",
  1159. make_day: make_day || "",
  1160. originPlace: origin_place,
  1161. deliveryPlace: delivery_place,
  1162. origin_place: Array.isArray(origin_place)
  1163. ? [origin_place[origin_place.length - 1]]
  1164. : origin_place,
  1165. delivery_place: Array.isArray(delivery_place)
  1166. ? [delivery_place[delivery_place.length - 1]]
  1167. : delivery_place,
  1168. supply_area: supply_area || "",
  1169. pay_way: pay_way || "",
  1170. remark: remark || "",
  1171. cost_desc: cost_desc || "",
  1172. good_img: good_img || []
  1173. };
  1174. this.origin_place_cn = [origin_place_cn];
  1175. this.delivery_place_cn = [delivery_place_cn];
  1176. this.spec_tableData = specinfo.map(item => ({
  1177. ...item,
  1178. specid: item.spec_id
  1179. }));
  1180. }
  1181. }
  1182. });
  1183. },
  1184. openEdit(index, sitem) {
  1185. this.modelIndex = index;
  1186. this.modelSitem = sitem;
  1187. this.showOtherModel = true;
  1188. },
  1189. openDelete(index) {
  1190. this.spec_tableData.splice(index, 1);
  1191. },
  1192. async getAddr(_code) {
  1193. const { data, code } = await asyncRequest.addrall({ code: _code });
  1194. return data.province.name + "/" + data.city.name + "/" + data.area.name;
  1195. },
  1196. //规格编辑修改结果
  1197. refreshEdit(e) {
  1198. let item = JSON.parse(JSON.stringify(e));
  1199. const { index, specid, spec_name, spec_value_id, spec_value_name } = item;
  1200. if (index + "" === "-1") {
  1201. this.spec_tableData.push(item);
  1202. } else {
  1203. let findex = parseInt(index + "");
  1204. this.spec_tableData[findex].specid = specid;
  1205. this.spec_tableData[findex].spec_name = spec_name;
  1206. this.spec_tableData[findex].spec_value_id = spec_value_id;
  1207. this.spec_tableData[findex].spec_value_name = spec_value_name;
  1208. }
  1209. this.showOtherModel = false;
  1210. },
  1211. //分类选择
  1212. async cat_id_change(e) {
  1213. const { pid, id, label, is_gold } = e;
  1214. this.pid = pid || "";
  1215. this.ruleForm.cat_id = id ? [id] : [];
  1216. this.$refs.ruleForm.validateField("cat_id");
  1217. const { is_gold_price } = this.ruleForm;
  1218. this.is_noble = is_gold;
  1219. this.setrules();
  1220. if (this.is_noble) {
  1221. this.ruleForm.cgd_charge = "0";
  1222. }
  1223. await this.set_must_spec();
  1224. },
  1225. setrules() {
  1226. let list1 = ["gold_weight", "is_gold_price", "is_diff"];
  1227. for (let i = 0; i < list1.length; i++) {
  1228. this.rulesThis[list1[i]][0].required = this.is_noble;
  1229. }
  1230. let list2 = ["noble_metal", "config", "other_config"];
  1231. for (let i = 0; i < list2.length; i++) {
  1232. this.rulesThis[list2[i]][0].required = this.pid === "6";
  1233. }
  1234. },
  1235. //品牌选择
  1236. brand_idsearchChange(e) {
  1237. const { id } = e;
  1238. this.ruleForm.brand_id = id ? [id] : [];
  1239. this.$refs.ruleForm.validateField("brand_id");
  1240. },
  1241. //税点选择
  1242. taxsearchChange(e) {
  1243. this.ruleForm.tax = e;
  1244. this.$refs.ruleForm.validateField("tax");
  1245. },
  1246. //供应商选择
  1247. supplierNosearchChange(e) {
  1248. const { code, name } = e;
  1249. this.ruleForm.supplierNo = code ? [code] : [];
  1250. this.supplierName = name;
  1251. this.$refs.ruleForm && this.$refs.ruleForm.validateField("supplierNo");
  1252. }, //业务公司选择
  1253. company_idsearchChange(e) {
  1254. const { code } = e;
  1255. this.ruleForm.customerCode = code || "";
  1256. this.$refs.ruleForm.validateField("customerCode");
  1257. },
  1258. //单位选择
  1259. unitsearchChange(e) {
  1260. const { code } = e;
  1261. this.ruleForm.unit_id = code ? [code] : [];
  1262. this.$refs.ruleForm.validateField("unit_id");
  1263. },
  1264. //金属种类选择
  1265. async noble_metalsearchChange(e) {
  1266. const { id } = e;
  1267. this.ruleForm.noble_metal = id ?? "";
  1268. this.$refs.ruleForm.validateField("noble_metal");
  1269. },
  1270. async selectAreaoriginChange(e) {
  1271. const { id, code } = e;
  1272. this.ruleForm.origin_place = id ? [id] : [];
  1273. this.ruleForm.originPlace = id ? code.split(",") : [];
  1274. this.$refs.ruleForm.validateField("origin_place");
  1275. },
  1276. async selectAreadeliveryChange(e) {
  1277. const { id, code } = e;
  1278. this.ruleForm.delivery_place = id ? [id] : [];
  1279. this.ruleForm.deliveryPlace = id ? code.split(",") : [];
  1280. this.$refs.ruleForm.validateField("delivery_place");
  1281. },
  1282. //图片上传成功
  1283. async UploadSuccessEventgood_img(data) {
  1284. await this.UploadSuccessEvent(1, data);
  1285. },
  1286. //图片上传成功
  1287. async UploadSuccessEvent(type, data) {
  1288. if (this.ruleForm.good_img.length > 10) {
  1289. this.$message.warning("上传图片最多不能超过10张");
  1290. return;
  1291. }
  1292. const { url } = data;
  1293. if (url === "noToken") {
  1294. await this.logout();
  1295. } else if (url === "noSupplierNo") {
  1296. // this.$notify({
  1297. // title: "当前供应商参数错误",
  1298. // dangerouslyUseHTMLString: true,
  1299. // message: "5秒后,请您重新登录!",
  1300. // });
  1301. // await setTimeout(async () => {
  1302. // await this.logout();
  1303. // }, 5000);
  1304. } else {
  1305. if (type === 1) {
  1306. this.ruleForm.good_img.push(url);
  1307. this.$refs.ruleForm.validateField("good_img");
  1308. } else if (type === 2) {
  1309. this.ruleForm.good_img.push(url);
  1310. this.$refs.ruleForm.validateField("good_img");
  1311. }
  1312. this.$message.success("图片上传成功!");
  1313. }
  1314. },
  1315. //图片上传失败
  1316. UploadErrorEventgood_img(res) {
  1317. this.imgUploadError(1, res);
  1318. },
  1319. imgUploadError(type, res) {
  1320. if (res !== "break") {
  1321. this.$message.error("图片上传失败!");
  1322. this.$refs.ruleForm.validateField(
  1323. type === 1 ? "good_img" : type === 2 ? "good_img" : ""
  1324. );
  1325. }
  1326. },
  1327. //判断图片规格
  1328. beforeAvatarUpload(file) {
  1329. let isJPG = false;
  1330. if (
  1331. file.type === "image/jpg" ||
  1332. file.type === "image/png" ||
  1333. file.type === "image/jpeg"
  1334. ) {
  1335. isJPG = true;
  1336. }
  1337. const isLt2M = file.size / 1024 / 1024 < 1;
  1338. if (!isJPG) {
  1339. this.$message.error("图片格式不正确!");
  1340. }
  1341. if (!isLt2M) {
  1342. this.$message.error("图片大小不能超过 1MB!");
  1343. }
  1344. return isJPG && isLt2M;
  1345. }
  1346. }
  1347. };
  1348. </script>
  1349. <style lang="scss" scoped>
  1350. .goodsCostDetail {
  1351. .goodsCostAdd-title {
  1352. border-top: 1px solid #ebeef5;
  1353. span {
  1354. height: 50px;
  1355. line-height: 50px;
  1356. font-family: "微软雅黑", sans-serif;
  1357. font-weight: 400;
  1358. font-style: normal;
  1359. font-size: 16px;
  1360. text-align: left;
  1361. }
  1362. }
  1363. }
  1364. i.el-icon-close {
  1365. position: absolute;
  1366. z-index: 2;
  1367. top: 0;
  1368. right: 0;
  1369. color: #63cbe7;
  1370. font-weight: bold;
  1371. cursor: pointer;
  1372. }
  1373. // /deep/ .fileUp {
  1374. // opacity: 10 !important;
  1375. // width: 228px !important;
  1376. // height: 200px !important;
  1377. // outline: none;
  1378. // position: static !important;
  1379. // }
  1380. </style>