columns.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878
  1. import { isSpecialSymbol, hasSpace } from '@/utils/validate'
  2. // 是否定制
  3. const options1 = [
  4. { id: '0', name: '否' },
  5. { id: '1', name: '是' }
  6. ]
  7. // 专属类型
  8. const options2 = [
  9. { id: '0', name: '非泰康' },
  10. { id: '1', name: '泰康' }
  11. ]
  12. // 销售权限
  13. const options3 = [
  14. { id: '0', name: '无销售权限' },
  15. { id: '1', name: '有销售权限' }
  16. ]
  17. // 是否库存品
  18. const options4 = [
  19. { id: '0', name: '非库存品' },
  20. { id: '1', name: '库存品' }
  21. ]
  22. // 是否启用实时金价
  23. const options5 = [
  24. { id: '0', name: '否' },
  25. { id: '1', name: '是' }
  26. ]
  27. // 供货区域
  28. const options6 = [
  29. { id: '1', name: '全国' },
  30. { id: '2', name: '全国除偏远' }
  31. ]
  32. // 是否启用阶梯
  33. const options7 = [
  34. { id: '0', name: '否' },
  35. { id: '1', name: '是' }
  36. ]
  37. // 有无工差
  38. const options8 = [
  39. { id: '0', name: '无工差' },
  40. { id: '1', name: '有工差' }
  41. ]
  42. // 配置要求
  43. const options9 = ['证书', '包装盒', '绒布袋', '标签', '其他']
  44. const listCol = [
  45. { type: 'selection', fixed: 'left', _noset_: true },
  46. {
  47. prop: 'spuCode',
  48. label: '编号',
  49. width: '160px'
  50. },
  51. {
  52. prop: 'good_thumb_img',
  53. label: '图片',
  54. _slot_: 'good_thumb_img',
  55. width: '45px'
  56. },
  57. {
  58. prop: 'good_name',
  59. label: '名称',
  60. 'min-width': '160px'
  61. },
  62. {
  63. prop: 'cat_name',
  64. label: '分类'
  65. },
  66. {
  67. prop: 'brand_name',
  68. label: '品牌'
  69. },
  70. {
  71. prop: "create_source",
  72. label: "来源",
  73. _slot_: "create_source",
  74. width: '110px'
  75. },
  76. {
  77. prop: 'is_stock',
  78. label: '库存类型',
  79. _slot_: 'is_stock',
  80. width: '85px'
  81. },
  82. {
  83. prop: 'is_combind',
  84. label: '组合类型',
  85. width: '95px',
  86. _slot_: 'is_combind'
  87. },
  88. {
  89. prop: 'isonline',
  90. label: '是否上线',
  91. _slot_: 'isonline',
  92. width: '70px'
  93. },
  94. {
  95. prop: 'status',
  96. label: '状态',
  97. _slot_: 'status',
  98. width: '118px'
  99. },
  100. {
  101. prop: 'supplierNo',
  102. label: '供应商编号',
  103. width: '110px'
  104. },
  105. {
  106. prop: 'supplier_name',
  107. label: '供应商名称',
  108. width: '110px'
  109. },
  110. {
  111. prop: 'companyNo',
  112. label: '业务公司编号',
  113. width: '110px'
  114. },
  115. {
  116. prop: 'company',
  117. label: '业务公司名称',
  118. width: '110px'
  119. },
  120. {
  121. prop: 'charger_company_name',
  122. label: '负责人部门',
  123. minWidth: '150px'
  124. },
  125. // {
  126. // prop: 'charger',
  127. // label: '负责人',
  128. // width: '70px'
  129. // },
  130. {
  131. prop: 'creater',
  132. label: '创建人',
  133. width: '70px'
  134. },
  135. {
  136. prop: 'addtime',
  137. label: '创建时间',
  138. width: '140px'
  139. },
  140. {
  141. prop: '',
  142. label: '操作',
  143. fixed: 'right',
  144. _noset_: true,
  145. width: '200px',
  146. _slot_: 'operation'
  147. }
  148. ]
  149. const validate_num = (rule, value, callback) => {
  150. const { required } = rule
  151. if (required && value === '') {
  152. callback(new Error('不能为空!'))
  153. } else {
  154. callback()
  155. }
  156. }
  157. const validate_num_0 = (rule, value, callback) => {
  158. const { required } = rule
  159. if (required && value === '') {
  160. callback(new Error('不能为空!'))
  161. } else if (
  162. required &&
  163. (value === '0' ||
  164. value === '0.' ||
  165. value === '0.0' ||
  166. value === '0.00' ||
  167. value === '0.000')
  168. ) {
  169. callback(new Error('不能为零!'))
  170. } else {
  171. callback()
  172. }
  173. }
  174. const validate_good_img = (rule, value, callback) => {
  175. const { required } = rule
  176. if (required && value.length == 0) {
  177. callback(new Error('请上传商品主图!'))
  178. } else if (required && (value.length < 3 || value.length > 10)) {
  179. callback(new Error('商品主图应为3~10张!'))
  180. } else {
  181. callback()
  182. }
  183. }
  184. const validate_desc = (rule, value, callback) => {
  185. const { required } = rule
  186. if (required && value.length == 0) {
  187. callback(new Error('不能为空!'))
  188. } else if (isSpecialSymbol(value)) {
  189. callback(new Error('不能使用英文特殊字符!'))
  190. } else {
  191. callback()
  192. }
  193. }
  194. const validate_good_name = (rule, value, callback) => {
  195. const { required } = rule
  196. if (required && value.length == 0) {
  197. callback(new Error('不能为空!'))
  198. } else if (hasSpace(value)) {
  199. callback(new Error('系统不允许输入转义字符,请检查后重新输入!'))
  200. } else if (isSpecialSymbol(value)) {
  201. callback(new Error('不能使用英文特殊字符!'))
  202. } else {
  203. callback()
  204. }
  205. }
  206. const rules = {
  207. cat_id: [
  208. {
  209. type: 'array',
  210. required: true,
  211. message: '请选择商品分类',
  212. trigger: 'change'
  213. }
  214. ],
  215. is_combind: [
  216. {
  217. required: true,
  218. message: '请选择组合类型',
  219. trigger: 'change'
  220. }
  221. ],
  222. brandid: [
  223. {
  224. type: 'array',
  225. required: true,
  226. message: '请选择商品品牌',
  227. trigger: 'change'
  228. }
  229. ],
  230. noble_weight: [
  231. {
  232. required: true,
  233. validator: validate_num_0,
  234. trigger: 'blur'
  235. }
  236. ],
  237. weight: [
  238. {
  239. required: true,
  240. validator: validate_num,
  241. trigger: 'blur'
  242. }
  243. ],
  244. good_type: [
  245. {
  246. required: true,
  247. message: '请选择是否定制',
  248. trigger: 'change'
  249. }
  250. ],
  251. is_stock: [
  252. {
  253. required: true,
  254. message: '请选择是否库存品',
  255. trigger: 'change'
  256. }
  257. ],
  258. company_id: [
  259. {
  260. required: true,
  261. message: '请选择业务公司',
  262. trigger: 'change'
  263. }
  264. ],
  265. supplierNo: [
  266. {
  267. type: 'array',
  268. required: true,
  269. message: '请选择供应商',
  270. trigger: 'change'
  271. }
  272. ],
  273. is_auth: [
  274. {
  275. required: true,
  276. message: '请选择是否有权限销售',
  277. trigger: 'change'
  278. }
  279. ],
  280. tax: [
  281. {
  282. required: true,
  283. message: '请选择税率',
  284. trigger: 'change'
  285. }
  286. ],
  287. good_name: [
  288. {
  289. required: true,
  290. validator: validate_good_name,
  291. trigger: 'blur'
  292. }
  293. ],
  294. unit: [
  295. {
  296. type: 'array',
  297. required: true,
  298. message: '请输入商品单位',
  299. trigger: 'blur'
  300. }
  301. ],
  302. is_exclusive: [
  303. {
  304. required: true,
  305. type: 'array',
  306. message: '请选择专属类型',
  307. trigger: 'change'
  308. }
  309. ],
  310. noble_metal: [
  311. {
  312. required: true,
  313. message: '请选择贵金属种类',
  314. trigger: 'change'
  315. }
  316. ],
  317. is_gold_price: [
  318. {
  319. required: true,
  320. message: '请选择是否启用实时金价',
  321. trigger: 'change'
  322. }
  323. ],
  324. moq: [
  325. {
  326. required: true,
  327. validator: validate_num,
  328. trigger: 'blur'
  329. }
  330. ],
  331. stock_moq: [
  332. {
  333. required: true,
  334. validator: validate_num_0,
  335. trigger: 'blur'
  336. }
  337. ],
  338. customized: [
  339. {
  340. required: true,
  341. validator: validate_num,
  342. trigger: 'blur'
  343. }
  344. ],
  345. after_sales: [
  346. {
  347. required: true,
  348. message: '售后说明不能为空',
  349. trigger: 'blur'
  350. },
  351. {
  352. required: true,
  353. validator: validate_desc,
  354. trigger: 'blur'
  355. }
  356. ],
  357. // isSpecialSymbol
  358. good_remark: [
  359. {
  360. required: true,
  361. message: '商品备注不能为空',
  362. trigger: 'blur'
  363. },
  364. {
  365. required: true,
  366. validator: validate_desc,
  367. trigger: 'blur'
  368. }
  369. ],
  370. // 包装/发货/图片
  371. packing_list: [
  372. {
  373. required: true,
  374. message: '请输入包装清单',
  375. trigger: 'blur'
  376. }
  377. ],
  378. packing_way: [
  379. {
  380. required: true,
  381. message: '请输入包装方式',
  382. trigger: 'blur'
  383. }
  384. ],
  385. packing_spec: [
  386. {
  387. required: true,
  388. message: '请输入装箱规格',
  389. trigger: 'blur'
  390. }
  391. ],
  392. packing_weight: [
  393. {
  394. required: true,
  395. message: '请输入装箱重量',
  396. trigger: 'blur'
  397. }
  398. ],
  399. packing_szie: [
  400. {
  401. required: true,
  402. message: '请输入装箱尺寸',
  403. trigger: 'blur'
  404. }
  405. ],
  406. supply_area: [
  407. {
  408. required: true,
  409. message: '请选择供货区域',
  410. trigger: 'change'
  411. }
  412. ],
  413. delivery_place: [
  414. {
  415. type: 'array',
  416. required: true,
  417. message: '请选择发货地',
  418. trigger: 'change'
  419. }
  420. ],
  421. origin_place: [
  422. {
  423. type: 'array',
  424. required: true,
  425. message: '请选择产地',
  426. trigger: 'change'
  427. }
  428. ],
  429. delivery_day: [
  430. {
  431. required: true,
  432. message: '请输入物流时间',
  433. trigger: 'blur'
  434. }
  435. ],
  436. lead_time: [
  437. {
  438. required: true,
  439. message: '请输入供货周期',
  440. trigger: 'blur'
  441. }
  442. ],
  443. sample_day: [
  444. {
  445. required: true,
  446. message: '请输入调样周期',
  447. trigger: 'blur'
  448. }
  449. ],
  450. packing_size: [
  451. {
  452. required: true,
  453. message: '请输入装箱尺寸',
  454. trigger: 'blur'
  455. }
  456. ],
  457. good_size: [
  458. {
  459. required: true,
  460. message: '请输入商品尺寸',
  461. trigger: 'blur'
  462. }
  463. ],
  464. good_thumb_img: [
  465. {
  466. required: true,
  467. message: '请上传商品缩略图',
  468. trigger: 'change'
  469. }
  470. ],
  471. good_img: [
  472. {
  473. type: 'array',
  474. required: true,
  475. validator: validate_good_img,
  476. trigger: 'change'
  477. }
  478. ],
  479. good_info_img: [
  480. {
  481. type: 'array',
  482. required: true,
  483. message: '至少上传一张商品详情介绍图',
  484. trigger: 'change'
  485. }
  486. ],
  487. demo_fee: [
  488. {
  489. required: true,
  490. validator: validate_num,
  491. trigger: 'blur'
  492. }
  493. ],
  494. is_diff: [
  495. {
  496. required: true,
  497. message: '请选择有无工差',
  498. trigger: 'change'
  499. }
  500. ],
  501. config: [
  502. {
  503. required: true,
  504. type: 'array',
  505. message: '请选择配置要求',
  506. trigger: 'change'
  507. }
  508. ],
  509. other_config: [
  510. {
  511. required: true,
  512. message: '其他要求不能为空',
  513. trigger: 'blur'
  514. }
  515. ],
  516. open_fee: [
  517. {
  518. required: true,
  519. validator: validate_num,
  520. trigger: 'blur'
  521. }
  522. ],
  523. sample_fee: [
  524. {
  525. required: true,
  526. validator: validate_num,
  527. trigger: 'blur'
  528. }
  529. ],
  530. market_price: [
  531. {
  532. required: true,
  533. validator: validate_num,
  534. trigger: 'blur'
  535. }
  536. ],
  537. cgd_gold_price: [
  538. {
  539. required: true,
  540. validator: validate_num,
  541. trigger: 'blur'
  542. }
  543. ],
  544. craft_desc: [
  545. {
  546. required: false,
  547. validator: validate_desc,
  548. trigger: 'blur'
  549. }
  550. ]
  551. }
  552. const basicColumns = [
  553. {
  554. prop: 'cat_info',
  555. label: '商品分类',
  556. span: 8,
  557. _slot_: 'cat_info'
  558. },
  559. {
  560. prop: 'good_img',
  561. label: '商品主图',
  562. _slot_: 'good_img',
  563. span: 8
  564. },
  565. {
  566. prop: 'good_info_img',
  567. _slot_: 'good_info_img',
  568. label: '详情介绍',
  569. span: 8
  570. },
  571. {
  572. prop: 'good_name',
  573. label: '商品名称',
  574. _slot_: 'good_name',
  575. span: 24
  576. },
  577. {
  578. prop: 'companyName',
  579. label: '业务公司',
  580. span: 12
  581. },
  582. {
  583. prop: 'supplierName',
  584. label: '供应商',
  585. span: 12
  586. },
  587. {
  588. prop: 'brand_name',
  589. label: '商品品牌',
  590. span: 6
  591. },
  592. {
  593. prop: 'is_auth',
  594. label: '销售权限',
  595. _slot_: 'is_auth',
  596. span: 6
  597. },
  598. {
  599. prop: 'unit',
  600. label: '单位',
  601. span: 6
  602. },
  603. {
  604. prop: 'tax',
  605. label: '税点',
  606. _slot_: 'tax',
  607. span: 6
  608. },
  609. {
  610. prop: 'is_exclusive',
  611. label: '专属类型',
  612. _slot_: 'is_exclusive',
  613. span: 6
  614. },
  615. {
  616. prop: 'weight',
  617. label: '商品总重量',
  618. _slot_: 'weight',
  619. span: 6
  620. },
  621. {
  622. prop: 'is_stock',
  623. label: '是否库存品',
  624. _slot_: 'is_stock',
  625. span: 6
  626. },
  627. {
  628. prop: 'is_combind',
  629. label: '组合类型',
  630. _slot_: 'is_combind',
  631. span: 6
  632. },
  633. {
  634. prop: 'noble',
  635. _slot_: 'noble',
  636. label: '贵金属信息',
  637. span: 18
  638. },
  639. {
  640. label: '来源',
  641. prop: 'create_source',
  642. _slot_: 'create_source',
  643. span: 6
  644. },
  645. {
  646. prop: 'after_sales',
  647. label: '售后说明',
  648. span: 24
  649. },
  650. {
  651. prop: 'good_remark',
  652. label: '商品备注',
  653. span: 24
  654. },
  655. {
  656. prop: 'craft_desc',
  657. label: '工艺说明',
  658. span: 24
  659. },
  660. {
  661. prop: 'packing_way',
  662. label: '包装方式',
  663. span: 6
  664. },
  665. {
  666. prop: 'packing_spec',
  667. label: '装箱规格',
  668. span: 6
  669. },
  670. {
  671. prop: 'packing_weight',
  672. label: '装箱重量',
  673. _slot_: 'packing_weight',
  674. span: 6
  675. },
  676. {
  677. prop: 'packing_size',
  678. label: '装箱尺寸',
  679. span: 6
  680. },
  681. {
  682. prop: 'good_size',
  683. label: '装箱尺寸',
  684. span: 6
  685. },
  686. {
  687. prop: 'good_bar',
  688. label: '商品条形码',
  689. span: 6
  690. },
  691. {
  692. prop: 'packing_list',
  693. label: '商品清单',
  694. span: 12
  695. },
  696. {
  697. prop: 'packing_spec',
  698. label: '供货区域',
  699. _slot_: 'packing_spec',
  700. span: 6
  701. },
  702. {
  703. prop: 'delivery_day',
  704. label: '物流天数',
  705. _slot_: 'delivery_day',
  706. span: 6
  707. },
  708. {
  709. prop: 'lead_time',
  710. label: '供货周期',
  711. _slot_: 'lead_time',
  712. span: 6
  713. },
  714. {
  715. prop: 'sample_day',
  716. label: '调样周期',
  717. _slot_: 'sample_day',
  718. span: 6
  719. },
  720. {
  721. prop: 'delivery_place',
  722. label: '发货地',
  723. span: 12,
  724. _slot_: 'delivery_place'
  725. },
  726. {
  727. prop: 'origin_place',
  728. label: '产地',
  729. span: 12,
  730. _slot_: 'origin_place'
  731. }
  732. ]
  733. const packingColumns = [
  734. {
  735. prop: 'packing_way',
  736. label: '包装方式',
  737. span: 6
  738. },
  739. {
  740. prop: 'packing_spec',
  741. label: '装箱规格',
  742. span: 6
  743. },
  744. {
  745. prop: 'packing_weight',
  746. label: '装箱重量',
  747. _slot_: 'packing_weight',
  748. span: 6
  749. },
  750. {
  751. prop: 'packing_size',
  752. label: '装箱尺寸',
  753. span: 6
  754. },
  755. {
  756. prop: 'good_size',
  757. label: '装箱尺寸',
  758. span: 6
  759. },
  760. {
  761. prop: 'good_bar',
  762. label: '商品条形码',
  763. span: 6
  764. },
  765. {
  766. prop: 'packing_list',
  767. label: '商品清单',
  768. span: 12
  769. }
  770. ]
  771. const sendColumns = [
  772. {
  773. prop: 'packing_spec',
  774. label: '供货区域',
  775. span: 6
  776. },
  777. {
  778. prop: 'delivery_day',
  779. label: '物流天数',
  780. _slot_: 'delivery_day',
  781. span: 6
  782. },
  783. {
  784. prop: 'lead_time',
  785. label: '供货周期',
  786. _slot_: 'lead_time',
  787. span: 6
  788. },
  789. {
  790. prop: 'sample_day',
  791. label: '调样周期',
  792. _slot_: 'sample_day',
  793. span: 6
  794. },
  795. {
  796. prop: 'delivery_place',
  797. label: '发货地',
  798. span: 12,
  799. _slot_: 'delivery_place'
  800. },
  801. {
  802. prop: 'origin_place',
  803. label: '产地',
  804. span: 12,
  805. _slot_: 'origin_place'
  806. }
  807. ]
  808. const imageColumns = [
  809. {
  810. prop: 'good_thumb_img',
  811. label: '图片缩略',
  812. _slot_: 'good_thumb_img',
  813. span: 6
  814. }
  815. ]
  816. const ladderColumns = [
  817. {
  818. prop: 'demo_fee',
  819. label: '打样费',
  820. _slot_: 'demo_fee',
  821. span: 6
  822. },
  823. {
  824. prop: 'open_fee',
  825. label: '开模费',
  826. _slot_: 'open_fee',
  827. span: 6
  828. },
  829. {
  830. prop: 'sample_fee',
  831. _slot_: 'sample_fee',
  832. label: '调样费',
  833. span: 6
  834. },
  835. {
  836. prop: 'market_price',
  837. _slot_: 'market_price',
  838. label: '市场价',
  839. span: 6
  840. },
  841. {
  842. prop: 'data_table',
  843. label: '阶梯成本',
  844. _slot_: 'data_table',
  845. span: 24
  846. }
  847. ]
  848. export {
  849. options1,
  850. options2,
  851. options3,
  852. options4,
  853. options5,
  854. options6,
  855. options7,
  856. options8,
  857. options9,
  858. listCol,
  859. rules,
  860. sendColumns,
  861. imageColumns,
  862. basicColumns,
  863. ladderColumns,
  864. packingColumns
  865. }