fixed-price-form.vue 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246
  1. <template>
  2. <div v-loading="loading">
  3. <!-- {{ sitem.is_gold_price }} -->
  4. <el-form
  5. :model="addrForm"
  6. ref="addrForm"
  7. status-icon
  8. class="demo-addrForm-goodsOnline"
  9. :size="'mini'"
  10. >
  11. <el-table
  12. :data="addrForm.good_ladder"
  13. :size="'mini'"
  14. border
  15. stripe
  16. max-height="300px"
  17. row-key="key"
  18. style="width: 100%; margin: 0 0 20px 0"
  19. >
  20. <el-table-column type="index" width="50" show-overflow-tooltip />
  21. <el-table-column
  22. prop="min_num"
  23. label="起订量(>=)"
  24. show-overflow-tooltip
  25. >
  26. <template slot-scope="scope">
  27. <el-form-item
  28. v-show="scope.row.edit"
  29. :prop="'good_ladder.' + scope.$index + '.' + 'min_num'"
  30. :rules="addrRules.min_num"
  31. :size="'mini'"
  32. :style="{ marginBottom: scope.row.edit ? '13px' : '0' }"
  33. >
  34. <digital-input
  35. :values="scope.row.min_num"
  36. :placeholder="'起订量(>=)'"
  37. :min="0"
  38. :max="100000000000"
  39. :position="'right'"
  40. :precision="0"
  41. :controls="false"
  42. :append="''"
  43. :newTime="scope.row.newTime"
  44. :size="'mini'"
  45. :disabled="!scope.row.edit"
  46. @reschange="num_change($event, 'min_num', scope.$index)"
  47. />
  48. </el-form-item>
  49. <span v-show="!scope.row.edit">{{ scope.row.min_num }}</span>
  50. </template>
  51. </el-table-column>
  52. <el-table-column prop="new_sale_price" show-overflow-tooltip>
  53. <template slot="header" slot-scope="scope">
  54. <span>系统售价</span>
  55. <!-- <el-popover
  56. placement="top-start"
  57. title="计算公式:"
  58. width="300"
  59. style="margin: 3px 0 0 0"
  60. class="fr"
  61. trigger="hover"
  62. ><div>
  63. <div v-if="sitem.is_gold_price === '1'">
  64. <span class="jiashu">贵金属克重</span>
  65. <span class="jiahao">*</span>
  66. <span class="jiashu">实时金价</span>
  67. <span class="jiahao">+</span>
  68. <span class="jiashu">工艺费</span>
  69. <span class="jiahao">*</span>
  70. <span class="jiashu">贵金属克重</span>
  71. <span class="jiahao">+</span>
  72. </div>
  73. <div>
  74. <span class="jiashu">包装费</span>
  75. <span class="jiahao">+</span>
  76. <span class="jiashu">裸价</span>
  77. <span class="jiahao">+</span>
  78. <span class="jiashu">加标费</span>
  79. <span class="jiahao">+</span>
  80. <span class="jiashu">证书费</span>
  81. <span class="jiahao">+</span>
  82. <span class="jiashu">物流费</span>
  83. </div>
  84. </div>
  85. <i class="el-icon-question tb-icon" slot="reference"></i>
  86. </el-popover> -->
  87. </template>
  88. <template slot-scope="scope">
  89. <el-form-item
  90. v-show="scope.row.edit"
  91. :prop="'good_ladder.' + scope.$index + '.' + 'new_sale_price'"
  92. :rules="addrRules.new_sale_price"
  93. :size="'mini'"
  94. :style="{ marginBottom: scope.row.edit ? '13px' : '0' }"
  95. >
  96. <el-input
  97. v-loading="scope.row.loading"
  98. v-model="scope.row.new_sale_price"
  99. placeholder="系统售价"
  100. :disabled="true"
  101. :size="'mini'"
  102. maxlength="20"
  103. />
  104. </el-form-item>
  105. <span v-show="!scope.row.edit">{{ scope.row.new_sale_price }}</span>
  106. </template>
  107. </el-table-column>
  108. <el-table-column
  109. prop="sale_price"
  110. label="售价"
  111. show-overflow-tooltip
  112. v-if="!(sitem && sitem.is_gold_price === '1' && is_noble)"
  113. >
  114. <template slot-scope="scope">
  115. <el-form-item
  116. v-show="scope.row.edit"
  117. :prop="'good_ladder.' + scope.$index + '.' + 'sale_price'"
  118. :rules="addrRules.sale_price"
  119. :size="'mini'"
  120. :style="{ marginBottom: scope.row.edit ? '13px' : '0' }"
  121. >
  122. <digital-input
  123. :values="scope.row.sale_price"
  124. :placeholder="'售价'"
  125. :min="0"
  126. :max="100000000000"
  127. :position="'right'"
  128. :precision="2"
  129. :controls="false"
  130. :append="''"
  131. :newTime="scope.row.newTime"
  132. :size="'mini'"
  133. :disabled="!scope.row.edit"
  134. @reschange="num_change($event, 'sale_price', scope.$index)"
  135. />
  136. </el-form-item>
  137. <span v-show="!scope.row.edit">{{ scope.row.sale_price }}</span>
  138. </template>
  139. </el-table-column>
  140. <el-table-column
  141. prop="new_cost_fee"
  142. show-overflow-
  143. v-if="sitem && sitem.is_gold_price === '1' && is_noble"
  144. label="系统工艺费"
  145. >
  146. <template slot-scope="scope">
  147. <el-form-item
  148. v-show="scope.row.edit"
  149. :prop="'good_ladder.' + scope.$index + '.' + 'new_cost_fee'"
  150. :rules="addrRules.new_cost_fee"
  151. :size="'mini'"
  152. :style="{ marginBottom: scope.row.edit ? '13px' : '0' }"
  153. >
  154. <el-input
  155. v-loading="scope.row.loading"
  156. v-model="scope.row.new_cost_fee"
  157. placeholder="工艺费"
  158. :disabled="true"
  159. :size="'mini'"
  160. maxlength="20"
  161. />
  162. </el-form-item>
  163. <span v-show="!scope.row.edit">{{ scope.row.new_cost_fee }}</span>
  164. </template>
  165. </el-table-column>
  166. <el-table-column
  167. prop="cost_fee"
  168. label="工艺费"
  169. show-overflow-tooltip
  170. v-if="sitem && sitem.is_gold_price === '1' && is_noble"
  171. >
  172. <template slot-scope="scope">
  173. <el-form-item
  174. v-show="scope.row.edit"
  175. :prop="'good_ladder.' + scope.$index + '.' + 'cost_fee'"
  176. :rules="addrRules.cost_fee"
  177. :size="'mini'"
  178. :style="{ marginBottom: scope.row.edit ? '13px' : '0' }"
  179. >
  180. <digital-input
  181. :values="scope.row.cost_fee"
  182. :placeholder="'工艺费'"
  183. :min="0"
  184. :max="100000000000"
  185. :position="'right'"
  186. :precision="2"
  187. :controls="false"
  188. :append="''"
  189. :newTime="scope.row.newTime"
  190. :size="'mini'"
  191. :disabled="!scope.row.edit"
  192. @reschange="num_change($event, 'cost_fee', scope.$index)"
  193. />
  194. </el-form-item>
  195. <span v-show="!scope.row.edit">{{ scope.row.cost_fee }}</span>
  196. </template>
  197. </el-table-column>
  198. <el-table-column
  199. prop="market_price"
  200. label="市场价"
  201. show-overflow-tooltip
  202. >
  203. <template slot-scope="scope">
  204. <el-form-item
  205. v-show="scope.row.edit"
  206. :prop="'good_ladder.' + scope.$index + '.' + 'market_price'"
  207. :rules="addrRules.market_price"
  208. :size="'mini'"
  209. :style="{ marginBottom: scope.row.edit ? '13px' : '0' }"
  210. >
  211. <digital-input
  212. :values="scope.row.market_price"
  213. :placeholder="'市场价'"
  214. :min="0"
  215. :max="100000000000"
  216. :position="'right'"
  217. :precision="2"
  218. :controls="false"
  219. :append="''"
  220. :newTime="scope.row.newTime"
  221. :size="'mini'"
  222. :disabled="!scope.row.edit"
  223. @reschange="num_change($event, 'market_price', scope.$index)"
  224. />
  225. </el-form-item>
  226. <span v-show="!scope.row.edit">{{ scope.row.market_price }}</span>
  227. </template>
  228. </el-table-column>
  229. <el-table-column
  230. prop="market_platform"
  231. label="对比平台"
  232. show-overflow-tooltip
  233. >
  234. <template slot-scope="scope">
  235. <el-form-item
  236. v-show="scope.row.edit"
  237. :prop="'good_ladder.' + scope.$index + '.' + 'market_platform'"
  238. :rules="addrRules.market_platform"
  239. :size="'mini'"
  240. :style="{ marginBottom: scope.row.edit ? '13px' : '0' }"
  241. >
  242. <el-input
  243. v-model="scope.row.market_platform"
  244. placeholder="对比平台"
  245. maxlength="50"
  246. :disabled="!scope.row.edit"
  247. />
  248. </el-form-item>
  249. <span v-show="!scope.row.edit">{{
  250. scope.row.market_platform
  251. }}</span>
  252. </template>
  253. </el-table-column>
  254. <el-table-column prop="status" label="状态" show-overflow-tooltip>
  255. <template slot-scope="scope">
  256. <el-form-item
  257. v-show="scope.row.edit"
  258. :prop="'good_ladder.' + scope.$index + '.' + 'status'"
  259. :rules="addrRules.status"
  260. :size="'mini'"
  261. :style="{ marginBottom: scope.row.edit ? '13px' : '0' }"
  262. >
  263. <el-select v-model="scope.row.status" placeholder="状态">
  264. <el-option
  265. v-for="item in status_options"
  266. :key="item.value"
  267. :label="item.label"
  268. :value="item.value"
  269. >
  270. </el-option>
  271. </el-select>
  272. </el-form-item>
  273. <span v-show="!scope.row.edit">{{
  274. scope.row.status == "1" ? "启用" : "禁用"
  275. }}</span>
  276. </template>
  277. </el-table-column>
  278. <el-table-column fixed="right">
  279. <template slot="header" slot-scope="scope">
  280. <span>操作</span>
  281. <el-tooltip effect="dark" content="添加阶梯" placement="top">
  282. <i
  283. class="el-icon-circle-plus-outline tb-icon fr"
  284. @click="openCostEdit(-1)"
  285. ></i>
  286. </el-tooltip>
  287. </template>
  288. <template slot-scope="scope">
  289. <el-tooltip
  290. effect="dark"
  291. content="保存"
  292. v-if="scope.row.edit"
  293. placement="top"
  294. >
  295. <i
  296. class="el-icon-circle-check tb-icon"
  297. @click="checkRow(scope.$index)"
  298. ></i>
  299. </el-tooltip>
  300. <el-tooltip effect="dark" v-else content="修改" placement="top">
  301. <i
  302. class="el-icon-edit tb-icon"
  303. @click="openCostEdit(scope.$index)"
  304. ></i>
  305. </el-tooltip>
  306. <el-tooltip effect="dark" content="删除" placement="top">
  307. <i
  308. class="el-icon-delete tb-icon"
  309. @click="openCostEditDelete(scope.$index)"
  310. ></i>
  311. </el-tooltip>
  312. </template>
  313. </el-table-column>
  314. </el-table>
  315. </el-form>
  316. <el-form
  317. ref="ruleForm"
  318. :model="ruleForm"
  319. status-icon
  320. :rules="rulesThis"
  321. class="demo-ruleForm-goodsOnline"
  322. :size="'mini'"
  323. >
  324. <el-row>
  325. <el-col :span="12"
  326. ><el-form-item label="审核状态" prop="state">
  327. <el-radio-group
  328. v-model="ruleForm.state"
  329. placeholder="请选择审核状态"
  330. style="width: 100%"
  331. :size="size || 'medium'"
  332. @change="stateChange"
  333. >
  334. <el-radio
  335. v-for="item in stateList"
  336. :key="item.value"
  337. :label="item.value"
  338. >{{ item.label }}</el-radio
  339. >
  340. </el-radio-group>
  341. </el-form-item>
  342. </el-col>
  343. <el-col :span="12">
  344. <el-form-item
  345. label="审核备注"
  346. v-if="ruleForm.state === '0'"
  347. prop="remark"
  348. >
  349. <el-input
  350. type="textarea"
  351. placeholder="审核备注"
  352. v-model="ruleForm.remark"
  353. :disabled="disabled"
  354. maxlength="250"
  355. show-word-limit
  356. :autosize="{ minRows: 3, maxRows: 3 }"
  357. />
  358. </el-form-item>
  359. <el-form-item class="fr" v-if="ruleForm.state === '0'" >
  360. <el-button
  361. v-if="!isDetail"
  362. :size="'mini'"
  363. type="primary"
  364. @click="rejectRe('')"
  365. >驳回重新审核
  366. </el-button>
  367. </el-form-item>
  368. <!-- <el-form-item class="fr" v-if="ruleForm.state === '0'" style="margin-right:30px;" >
  369. <el-button
  370. v-if="!isDetail"
  371. :size="'mini'"
  372. type="danger"
  373. @click="rejectRe('8')"
  374. >驳回并下线
  375. </el-button>
  376. </el-form-item> -->
  377. </el-col>
  378. <el-col :span="24" v-if="ruleForm.state === '1'"
  379. ><el-form-item label="售价凭证类型" prop="proof_type">
  380. <el-radio-group
  381. v-model="ruleForm.proof_type"
  382. @change="set_proof_url()"
  383. >
  384. <el-radio
  385. v-for="item in options"
  386. :key="item.value"
  387. :label="item.value"
  388. >{{ item.label }}</el-radio
  389. >
  390. </el-radio-group>
  391. <el-button class="fr" type="primary" @click="showVoucher = true"
  392. >查看历史凭证</el-button
  393. >
  394. </el-form-item>
  395. <show-voucher-model
  396. :showModel="showVoucher"
  397. :id="spuCode"
  398. @cancel="showVoucher = false"
  399. @searchChange="resvoucher"
  400. />
  401. </el-col>
  402. <el-col :span="18" v-if="ruleForm.state === '1'">
  403. <el-form-item label="凭证文件" prop="proof_url">
  404. <ul class="shangchuan-ul">
  405. <li v-if="ruleForm.proof_type === '1'" class="shiping">
  406. <div v-if="video_url" class="clearfix">
  407. <el-popover placement="top" width="300" trigger="hover">
  408. <video width="275" controls class="fl">
  409. <source :src="video_url" type="video/mp4" />
  410. <source :src="video_url" type="video/avi" />
  411. 您的浏览器不支持Video标签。
  412. </video>
  413. <i
  414. class="el-icon-video-camera-solid hover"
  415. style="font-size: 18px"
  416. slot="reference"
  417. ></i>
  418. </el-popover>
  419. <el-link
  420. :underline="false"
  421. @click="deleteUrl('1')"
  422. type="warning"
  423. style="margin: 0 0 0 16px"
  424. >删除</el-link
  425. >
  426. </div>
  427. <div class="activity-upload" v-else>
  428. <div class="btnupload" style="position: relative">
  429. <i class="el-icon-plus avatar-uploader-icon"></i>
  430. <video-upload
  431. class="Upload"
  432. :disabled="type === 'view' || type === 'editCoin'"
  433. :accept="'.mp4,.avi'"
  434. :multiple="false"
  435. :uploadcondition="beforeVideoUpload"
  436. @UploadErrorEvent="UploadVideoEventproof_url"
  437. @UploadSuccessEvent="UploadSuccessVideoproof_url"
  438. />
  439. </div>
  440. <div class="txt-tips fl">
  441. <p>建议大小:小于10MB</p>
  442. <p>文件格式:.mp4,.avi</p>
  443. </div>
  444. </div>
  445. </li>
  446. <li v-if="ruleForm.proof_type === '2'" class="tupian">
  447. <div v-if="img_url" class="clearfix">
  448. <img
  449. style="width: 50px; height: 50px"
  450. :src="img_url"
  451. class="avatar fl"
  452. />
  453. <el-link
  454. :underline="false"
  455. @click="deleteUrl('2')"
  456. type="warning"
  457. style="margin: 0 0 0 16px"
  458. >删除</el-link
  459. >
  460. </div>
  461. <div class="activity-upload" v-else>
  462. <div class="btnupload" style="position: relative">
  463. <i class="el-icon-plus avatar-uploader-icon"></i>
  464. <file-upload
  465. class="Upload"
  466. :disabled="type === 'view' || type === 'editCoin'"
  467. :accept="'.jpg,.png,.jpeg'"
  468. :multiple="false"
  469. :uploadcondition="beforeAvatarUpload"
  470. @UploadErrorEvent="UploadErrorEventproof_url"
  471. @UploadSuccessEvent="UploadSuccessEventproof_url"
  472. ></file-upload>
  473. </div>
  474. <div class="txt-tips fl">
  475. <p>建议大小:小于1MB</p>
  476. <p>文件格式:.jpg,.png,.jpeg</p>
  477. </div>
  478. </div>
  479. </li>
  480. <li v-if="ruleForm.proof_type === '3'" class="qita">
  481. <div v-if="other_url" class="clearfix">
  482. <a :href="other_url" download="凭证文件">点击下载</a>
  483. <el-link
  484. :underline="false"
  485. @click="deleteUrl('3')"
  486. type="warning"
  487. style="margin: 0 0 0 16px"
  488. >删除</el-link
  489. >
  490. </div>
  491. <div class="activity-upload" v-else>
  492. <div class="btnupload" style="position: relative">
  493. <i class="el-icon-plus avatar-uploader-icon"></i>
  494. <file-upload-pdf
  495. class="Upload"
  496. :accept="'.xlsx,.xls,.pdf,.zip,.rar,.7z'"
  497. :multiple="false"
  498. :uploadcondition="beforeOtherUpload"
  499. @UploadErrorEvent="UploadErrorOtherproof_url"
  500. @UploadSuccessEvent="UploadSuccessOtherproof_url"
  501. />
  502. </div>
  503. <div class="txt-tips fl">
  504. <p>建议大小:小于5MB</p>
  505. <p>文件格式:.xlsx,.xls,.pdf,.zip,.rar,.7z</p>
  506. </div>
  507. </div>
  508. </li>
  509. </ul>
  510. </el-form-item>
  511. </el-col>
  512. <el-col :span="6" v-if="ruleForm.state === '1'">
  513. <el-form-item class="fr">
  514. <el-button
  515. v-if="!isDetail"
  516. :size="'mini'"
  517. type="primary"
  518. @click="submitForm"
  519. >保 存
  520. </el-button>
  521. </el-form-item>
  522. </el-col>
  523. </el-row>
  524. </el-form>
  525. </div>
  526. </template>
  527. <script>
  528. // import costFormAddEdit from "./costFormAddEdit";
  529. import asyncRequest from "@/apis/service/goodStore/goodsOnline";
  530. import showVoucherModel from "@/components/show-voucher-model";
  531. export default {
  532. name: "exam-form",
  533. props: [
  534. "size",
  535. "statusList",
  536. "disabled",
  537. "isMust",
  538. "labelWidth",
  539. "id",
  540. "spuCode",
  541. "sitem",
  542. ],
  543. components: {
  544. // costFormAddEdit,
  545. showVoucherModel,
  546. },
  547. /**
  548. * 属性集合
  549. * @param {String} size : 组件大小 非必填
  550. * @param {Array} statusList : 驳回至备选项 必填
  551. * @param {Boolean} disabled : 是否禁用 必填
  552. * @param {Boolean} isMust : 是否需要展示驳回节点 必填
  553. *
  554. *
  555. */
  556. /**
  557. * 事件集合
  558. * @searchChange : 选中值变化调用 抛出选中数据
  559. */
  560. data() {
  561. const validate_num = (rule, value, callback) => {
  562. const { required } = rule;
  563. if (required && value === "") {
  564. callback(new Error("不能为空!"));
  565. } else {
  566. callback();
  567. }
  568. };
  569. const validate_num_0 = (rule, value, callback) => {
  570. const { required } = rule;
  571. if (required && value === "") {
  572. callback(new Error("不能为空!"));
  573. } else if (
  574. required &&
  575. (value === "0" ||
  576. value === "0." ||
  577. value === "0.0" ||
  578. value === "0.00" ||
  579. value === "0.000")
  580. ) {
  581. callback(new Error("不能为零!"));
  582. } else {
  583. callback();
  584. }
  585. };
  586. return {
  587. loading: false,
  588. stateList: [
  589. {
  590. value: "1",
  591. label: "通过",
  592. },
  593. {
  594. value: "0",
  595. label: "驳回",
  596. },
  597. ],
  598. showVoucher: false,
  599. is_noble: false,
  600. video_url: "",
  601. img_url: "",
  602. other_url: "",
  603. options: [
  604. {
  605. value: "1",
  606. label: "视频",
  607. },
  608. {
  609. value: "2",
  610. label: "图片",
  611. },
  612. {
  613. value: "3",
  614. label: "其他",
  615. },
  616. ],
  617. status_options: [
  618. {
  619. value: "1",
  620. label: "启用",
  621. },
  622. {
  623. value: "0",
  624. label: "禁用",
  625. },
  626. ],
  627. showModelThis: this.showModel,
  628. pickerOptions: {
  629. disabledDate(time) {
  630. return time.getTime() < Date.now() - 60 * 60 * 24 * 1000;
  631. },
  632. },
  633. costshowModel: false,
  634. costmodelIndex: "",
  635. costsitem: {},
  636. ruleForm: {
  637. skuCode: "",
  638. numStatus:"",
  639. state:"1",//通过or驳回
  640. proof_type: "1", //
  641. proof_url: "", //驳回至
  642. remark:"",
  643. },
  644. rulesThis: this.rules,
  645. rules: {
  646. proof_type: [
  647. {
  648. required: true,
  649. message: "请选择凭证类型",
  650. trigger: "change",
  651. },
  652. ],
  653. proof_url: [
  654. {
  655. required: true,
  656. message: "请上传凭证文件",
  657. trigger: "blur,change",
  658. },
  659. ],
  660. rebut: [
  661. {
  662. required: true,
  663. message: "请选择驳回节点",
  664. trigger: "change",
  665. },
  666. ],
  667. state: [
  668. {
  669. required: true,
  670. message: "请选择审核状态",
  671. trigger: "change",
  672. },
  673. ],
  674. remark: [
  675. { required: true, message: "请输入审核备注", trigger: "blur" },
  676. {
  677. min: 1,
  678. max: 250,
  679. message: "长度在 1 到 250 个字符",
  680. trigger: "blur",
  681. },
  682. ],
  683. },
  684. addrForm: {
  685. good_ladder: [],
  686. },
  687. addrRules: {
  688. min_num: [
  689. {
  690. required: true,
  691. validator: validate_num_0,
  692. trigger: "blur",
  693. },
  694. ],
  695. new_sale_price: [{ required: false }],
  696. sale_price: [
  697. {
  698. required: true,
  699. trigger: "blur",
  700. validator: validate_num,
  701. },
  702. ],
  703. cost_fee: [
  704. {
  705. required: true,
  706. trigger: "blur",
  707. validator: validate_num,
  708. },
  709. ],
  710. new_cost_fee: [
  711. {
  712. required: false,
  713. },
  714. ],
  715. market_price: [
  716. {
  717. required: true,
  718. validator: validate_num,
  719. trigger: "blur",
  720. },
  721. ],
  722. market_platform: [
  723. {
  724. required: true,
  725. message: "对比平台不能为空",
  726. trigger: "blur",
  727. },
  728. ],
  729. status: [
  730. {
  731. required: true,
  732. message: "状态不能为空",
  733. trigger: "change",
  734. },
  735. ],
  736. },
  737. };
  738. },
  739. watch: {
  740. isDetail: function (val, old) {
  741. if (this.isDetail !== val) {
  742. this.options = [];
  743. this.selectLoading = false;
  744. }
  745. },
  746. newTime: function (val) {
  747. if (val) {
  748. this.initForm();
  749. }
  750. },
  751. },
  752. mounted() {
  753. this.initForm();
  754. },
  755. methods: {
  756. // 点击驳回重新审核或驳回并下线按钮
  757. async rejectRe(numStatus) {
  758. this.ruleForm.numStatus = numStatus
  759. await this.$refs.ruleForm.validate(async (valid) => {
  760. if (valid) {
  761. console.log(valid)
  762. this.$emit("searchChange", this.ruleForm);
  763. } else {
  764. console.log("error submit!!");
  765. return false;
  766. }
  767. });
  768. },
  769. async initForm() {
  770. console.log(this.spuCode);
  771. this.loading = true;
  772. await this.resetForm();
  773. this.rulesThis = this.rules;
  774. this.stateChange()
  775. this.loading = false;
  776. },
  777. stateChange() {
  778. if (this.ruleForm.state === "1") {
  779. this.rulesThis.rebut[0].required = false;
  780. this.rulesThis.remark[0].required = false;
  781. } else {
  782. this.rulesThis.rebut[0].required = true;
  783. this.rulesThis.remark[0].required = true;
  784. }
  785. },
  786. openCostEdit(index) {
  787. let findex = this.addrForm.good_ladder.findIndex((v) => v.edit === true);
  788. if (findex !== -1) {
  789. this.$message.warning("当前已有阶梯售价在编辑,请保存后再试!");
  790. return;
  791. } else {
  792. if (index === -1) {
  793. this.addrForm.good_ladder.push({
  794. edit: true,
  795. min_num: "0",
  796. new_sale_price: "0",
  797. new_cost_fee: "0",
  798. sale_price: "0",
  799. cost_fee: "0",
  800. market_price: "0",
  801. market_platform: "",
  802. status: "1",
  803. });
  804. } else {
  805. this.addrForm.good_ladder[index].edit = true;
  806. this.addrForm.good_ladder[index].newTime = new Date().valueOf() + "";
  807. }
  808. }
  809. },
  810. async get_new(index) {
  811. const { min_num } = this.addrForm.good_ladder[index];
  812. this.addrForm.good_ladder[index].search_loading = true;
  813. let { code, data, message } = await asyncRequest.goodupprice({
  814. min_num: min_num,
  815. spuCode: this.spuCode,
  816. });
  817. let resModel = {
  818. isok: code,
  819. price: code === 0 ? data.sale_price : "0",
  820. new_cost_fee: code === 0 ? data.new_cost_fee : "0",
  821. message: message,
  822. };
  823. this.addrForm.good_ladder[index].search_loading = false;
  824. return resModel;
  825. },
  826. //保存某一行
  827. async checkRow(rowIndex) {
  828. await this.$refs.addrForm.validate(async (valid) => {
  829. if (valid) {
  830. if (!this.addrForm.good_ladder[rowIndex].search_loading) {
  831. const { min_num } = this.addrForm.good_ladder[rowIndex];
  832. let findex = this.addrForm.good_ladder.findIndex(
  833. (v) => v.edit !== true && v.min_num + "" === min_num + ""
  834. );
  835. if (findex !== -1) {
  836. this.$message.warning("当前已有相同起订量的销售价!");
  837. return;
  838. }
  839. let { isok, price, message, new_cost_fee } = await this.get_new(
  840. rowIndex
  841. );
  842. if (isok === 0) {
  843. this.addrForm.good_ladder[rowIndex].new_sale_price = price;
  844. this.addrForm.good_ladder[rowIndex].new_cost_fee = new_cost_fee;
  845. this.addrForm.good_ladder[rowIndex].edit = false;
  846. } else if (isok >= 100 && isok <= 104) {
  847. await this.logout();
  848. } else {
  849. this.addrForm.good_ladder[rowIndex].new_sale_price = price;
  850. this.addrForm.good_ladder[rowIndex].new_cost_fee = new_cost_fee;
  851. this.$message.warning(message);
  852. }
  853. }
  854. } else {
  855. console.log("error submit!!");
  856. return false;
  857. }
  858. });
  859. },
  860. openCostEditDelete(index) {
  861. this.addrForm.good_ladder.splice(index, 1);
  862. },
  863. async num_change(e, key, index) {
  864. this.addrForm.good_ladder[index][key] = e + "" || "0";
  865. if (key === "min_num") {
  866. const { min_num } = this.addrForm.good_ladder[index];
  867. if (min_num === "" || min_num === "0") {
  868. this.addrForm.good_ladder[index].new_sale_price = "0";
  869. } else {
  870. if (!this.addrForm.good_ladder[index].search_loading) {
  871. let { isok, price, message, new_cost_fee } = await this.get_new(
  872. index
  873. );
  874. if (isok === 0) {
  875. this.addrForm.good_ladder[index].new_sale_price = price;
  876. this.addrForm.good_ladder[index].new_cost_fee = new_cost_fee;
  877. } else if (isok >= 100 && isok <= 104) {
  878. await this.logout();
  879. } else {
  880. this.addrForm.good_ladder[index].new_sale_price = price;
  881. this.addrForm.good_ladder[index].new_cost_fee = new_cost_fee;
  882. this.$message.warning(message);
  883. }
  884. }
  885. }
  886. }
  887. },
  888. async resetForm() {
  889. this.is_noble = false;
  890. // 重置
  891. await this.$nextTick(async () => {
  892. if (this.$refs.ruleForm && this.$refs.addrForm) {
  893. this.$refs.ruleForm.resetFields();
  894. this.$refs.ruleForm.clearValidate();
  895. this.$refs.addrForm.resetFields();
  896. this.$refs.addrForm.clearValidate();
  897. let { proof, ladderlist, cat_info } = this.sitem;
  898. if (cat_info && cat_info.length > 0) {
  899. cat_info.forEach((e) => {
  900. if (e.id === "6") {
  901. this.is_noble = true;
  902. }
  903. });
  904. }
  905. ladderlist.map((a) => {
  906. a.search_loading = false;
  907. a.new_sale_price = "0";
  908. a.newTime = new Date().valueOf() + "";
  909. a.edit = false;
  910. return a;
  911. });
  912. this.ruleForm = {
  913. skuCode: this.id,
  914. state: "1", // 通过or驳回
  915. remark:"",
  916. numStatus:"",
  917. proof_type: proof && proof.proof_type ? proof.proof_type : "1", // 通过or驳回
  918. proof_url: proof && proof.proof_url ? proof.proof_url : "", //驳回至
  919. };
  920. this.addrForm = {
  921. good_ladder:
  922. ladderlist && ladderlist.length > 0
  923. ? JSON.parse(JSON.stringify(ladderlist))
  924. : [],
  925. };
  926. // console.log(this.ruleForm.proof_url);
  927. switch (this.ruleForm.proof_type) {
  928. case "1":
  929. this.video_url = this.ruleForm.proof_url;
  930. break;
  931. case "2":
  932. this.img_url = this.ruleForm.proof_url;
  933. break;
  934. case "3":
  935. this.other_url = this.ruleForm.proof_url;
  936. break;
  937. default:
  938. this.video_url = this.ruleForm.proof_url;
  939. }
  940. this.$refs.ruleForm.validateField("proof_url");
  941. for (let i = 0; i < this.addrForm.good_ladder.length; i++) {
  942. let { isok, price, new_cost_fee, message } = await this.get_new(i);
  943. if (isok === 0) {
  944. this.addrForm.good_ladder[i].new_sale_price = price;
  945. this.addrForm.good_ladder[i].new_cost_fee = new_cost_fee;
  946. this.addrForm.good_ladder[i].edit = false;
  947. } else if (isok >= 100 && isok <= 104) {
  948. await this.logout();
  949. } else {
  950. this.addrForm.good_ladder[i].new_sale_price = price;
  951. this.addrForm.good_ladder[i].new_cost_fee = new_cost_fee;
  952. this.addrForm.good_ladder[i].edit = true;
  953. this.addrForm.good_ladder[i].newTime = new Date().valueOf() + "";
  954. this.$message.warning(message);
  955. }
  956. }
  957. }
  958. });
  959. },
  960. async submitForm() {
  961. await this.$refs.ruleForm.validate(async (valid) => {
  962. if (valid) {
  963. this.loading = true;
  964. let model = JSON.parse(JSON.stringify(this.ruleForm));
  965. if (this.addrForm.good_ladder.length === 0) {
  966. this.$message.warning("至少添加一条销售价信息!");
  967. this.loading = false;
  968. return;
  969. }
  970. let list = JSON.parse(JSON.stringify(this.addrForm.good_ladder));
  971. let isedit = false;
  972. list.forEach((v) => {
  973. if (v.edit) {
  974. isedit = true;
  975. }
  976. });
  977. if (isedit) {
  978. this.$message.warning("请保存阶梯售价!");
  979. this.loading = false;
  980. return;
  981. }
  982. let all_is_ok = true;
  983. for (let i = 0; i < this.addrForm.good_ladder; i++) {
  984. this.addrForm.good_ladder[i].search_loading = true;
  985. let { isok, price, new_cost_fee } = await this.get_new(i);
  986. if (isok === 0) {
  987. this.addrForm.good_ladder[i].new_sale_price = price;
  988. this.addrForm.good_ladder[i].new_cost_fee = new_cost_fee;
  989. this.addrForm.good_ladder[i].this.addrForm.good_ladder[
  990. i
  991. ].edit = false;
  992. } else if (isok >= 100 && isok <= 104) {
  993. await this.logout();
  994. } else {
  995. all_is_ok = false;
  996. this.addrForm.good_ladder[i].new_sale_price = price;
  997. this.addrForm.good_ladder[i].new_cost_fee = new_cost_fee;
  998. this.addrForm.good_ladder[i].edit = true;
  999. this.addrForm.good_ladder[i].newTime = new Date().valueOf() + "";
  1000. }
  1001. }
  1002. if (!all_is_ok) {
  1003. this.$message.warning("阶梯售价未满足成本最低起订量!");
  1004. this.loading = false;
  1005. }
  1006. let list2 = [];
  1007. list.forEach((e) => {
  1008. let n = JSON.parse(JSON.stringify(e));
  1009. for (let key in n) {
  1010. n[key] += "";
  1011. }
  1012. delete n["index"];
  1013. list2.push(n);
  1014. });
  1015. model.good_ladder = list2;
  1016. model.skuCode = this.id;
  1017. let res = await asyncRequest.ladderOne(model);
  1018. this.loading = false;
  1019. if (res && res.code === 0) {
  1020. this.$notify.success({
  1021. title: "信息提交成功",
  1022. message: "",
  1023. });
  1024. this.$emit("resSuccess", true);
  1025. } else if (res && res.code >= 100 && res.code <= 104) {
  1026. await this.logout();
  1027. } else {
  1028. this.$message.warning(res.message);
  1029. }
  1030. } else {
  1031. console.log("error submit!!");
  1032. return false;
  1033. }
  1034. });
  1035. },
  1036. resvoucher(e) {
  1037. const { proof_type, proof_url } = e;
  1038. this.ruleForm.proof_type = proof_type || "1";
  1039. switch (this.ruleForm.proof_type) {
  1040. case "1":
  1041. this.video_url = proof_url;
  1042. break;
  1043. case "2":
  1044. this.img_url = proof_url;
  1045. break;
  1046. case "3":
  1047. this.other_url = proof_url;
  1048. break;
  1049. default:
  1050. this.video_url = proof_url;
  1051. }
  1052. this.set_proof_url();
  1053. },
  1054. //图片上传成功
  1055. async UploadSuccessEventproof_url(data) {
  1056. const { url } = data;
  1057. if (url === "noToken") {
  1058. await this.logout();
  1059. } else {
  1060. this.img_url = url;
  1061. this.set_proof_url();
  1062. this.$message.success("图片上传成功!");
  1063. }
  1064. },
  1065. //图片上传失败
  1066. UploadErrorEventproof_url(res) {
  1067. if (res !== "break") {
  1068. this.set_proof_url();
  1069. this.$message.error("图片上传失败!");
  1070. }
  1071. },
  1072. //判断图片规格
  1073. beforeAvatarUpload(file) {
  1074. let isJPG = false;
  1075. if (
  1076. file.type === "image/jpg" ||
  1077. file.type === "image/png" ||
  1078. file.type === "image/jpeg"
  1079. ) {
  1080. isJPG = true;
  1081. }
  1082. const isLt2M = file.size / 1024 / 1024 < 1;
  1083. if (!isJPG) {
  1084. this.$message.error("图片格式不正确!");
  1085. }
  1086. if (!isLt2M) {
  1087. this.$message.error("图片大小不能超过 1MB!");
  1088. }
  1089. return isJPG && isLt2M;
  1090. },
  1091. //视频上传成功
  1092. async UploadSuccessVideoproof_url(data) {
  1093. const { url } = data;
  1094. if (url === "noToken") {
  1095. await this.logout();
  1096. } else {
  1097. this.video_url = url;
  1098. this.set_proof_url();
  1099. this.$message.success("视频上传成功!");
  1100. }
  1101. },
  1102. //视频上传失败
  1103. UploadErrorVideoproof_url(res) {
  1104. if (res !== "break") {
  1105. this.set_proof_url();
  1106. this.$message.error("视频上传失败!");
  1107. }
  1108. },
  1109. //判断视频规格
  1110. beforeVideoUpload(file) {
  1111. let isJPG = false;
  1112. if (file.type === "video/mp4" || file.type === "video/avi") {
  1113. isJPG = true;
  1114. }
  1115. const isLt2M = file.size / 1024 / 1024 < 10;
  1116. if (!isJPG) {
  1117. this.$message.error("视频格式不正确!");
  1118. }
  1119. if (!isLt2M) {
  1120. this.$message.error("视频大小不能超过 10MB!");
  1121. }
  1122. return isJPG && isLt2M;
  1123. },
  1124. // 其他文件上传成功
  1125. async UploadSuccessOtherproof_url(data) {
  1126. const { url } = data;
  1127. if (url === "noToken") {
  1128. await this.logout();
  1129. } else {
  1130. this.other_url = url;
  1131. this.set_proof_url();
  1132. this.$message.success("文件成功!");
  1133. }
  1134. },
  1135. //其他文件上传失败
  1136. UploadErrorOtherproof_url(res) {
  1137. if (res !== "break") {
  1138. this.set_proof_url();
  1139. this.$message.error("文件上传失败!");
  1140. }
  1141. },
  1142. //判断其他文件规格
  1143. beforeOtherUpload(file) {
  1144. console.log(file);
  1145. let isJPG = false;
  1146. if (
  1147. file.type === "application/vnd.ms-excel" ||
  1148. file.type ===
  1149. "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ||
  1150. file.type === "application/pdf" ||
  1151. file.type === "application/x-zip-compressed"
  1152. ) {
  1153. isJPG = true;
  1154. }
  1155. let name = file.name;
  1156. let list = name.split(".");
  1157. if (list[list.length - 1] === "rar" || list[list.length - 1] === "7z") {
  1158. isJPG = true;
  1159. }
  1160. const isLt2M = file.size / 1024 / 1024 < 5;
  1161. if (!isJPG) {
  1162. this.$message.error("文件格式不正确!");
  1163. }
  1164. if (!isLt2M) {
  1165. this.$message.error("文件大小不能超过 5MB!");
  1166. }
  1167. return isJPG && isLt2M;
  1168. },
  1169. deleteUrl(type) {
  1170. switch (type) {
  1171. case "1":
  1172. this.video_url = "";
  1173. break;
  1174. case "2":
  1175. this.img_url = "";
  1176. break;
  1177. case "3":
  1178. this.other_url = "";
  1179. break;
  1180. default:
  1181. this.video_url = "";
  1182. }
  1183. this.set_proof_url();
  1184. },
  1185. set_proof_url() {
  1186. const { proof_type } = this.ruleForm;
  1187. switch (proof_type) {
  1188. case "1":
  1189. this.ruleForm.proof_url = this.video_url;
  1190. break;
  1191. case "2":
  1192. this.ruleForm.proof_url = this.img_url;
  1193. break;
  1194. case "3":
  1195. this.ruleForm.proof_url = this.other_url;
  1196. break;
  1197. default:
  1198. this.ruleForm.proof_url = this.video_url;
  1199. }
  1200. this.$refs.ruleForm.validateField("proof_url");
  1201. },
  1202. },
  1203. };
  1204. </script>
  1205. <style lang="scss" scoped>
  1206. .demo-ruleForm-goodsOnline {
  1207. .shangchuan-ul {
  1208. li {
  1209. position: relative;
  1210. width: 100%;
  1211. &.tupian {
  1212. }
  1213. }
  1214. }
  1215. }
  1216. </style>