columns.js 13 KB

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