fixed-price-form.vue 39 KB

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