index.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901
  1. <template>
  2. <template-page
  3. ref="pageRef"
  4. :get-list="getList"
  5. :exportList="exportList"
  6. :table-attributes="tableAttributes"
  7. :table-events="tableEvents"
  8. :options-evens-group="optionsEvensGroup"
  9. :moreParameters="moreParameters"
  10. :column-parsing="columnParsing"
  11. :operation="operation()"
  12. :replaceOrNotMap="false"
  13. >
  14. <div class="cartographer">
  15. <el-dialog title="增值服务配置" width="100%" :modal="false" :visible.sync="formDialog" :before-close="formCancel">
  16. <zj-form-container v-if="formDialog" ref="formRef" :form-data="formData" :styleSwitch="false">
  17. <zj-form-module
  18. title="新增"
  19. label-width="120px"
  20. :showPackUp="false"
  21. :form-data="formData"
  22. :form-items="formItems"
  23. >
  24. </zj-form-module>
  25. </zj-form-container>
  26. <div slot="footer" class="dialog-footer">
  27. <el-button size="mini" @click="formCancel">取 消</el-button>
  28. <el-button size="mini" @click="formConfirm" type="primary">确定</el-button>
  29. </div>
  30. </el-dialog>
  31. </div>
  32. </template-page>
  33. </template>
  34. <script>
  35. import TemplatePage from '@/components/template/template-page-1.vue'
  36. import import_mixin from '@/components/template/import_mixin.js'
  37. import {
  38. increConfigList,
  39. increConfigListExport,
  40. increConfigDetail,
  41. increConfigAdd,
  42. increConfigUpdate,
  43. increConfigUpOrDown
  44. } from '@/api/valueAddedConfig.js'
  45. import { required, mobileRequired, mobile, httpUrl, email } from '@/components/template/rules_verify.js'
  46. import { getClassifyList } from '@/api/goods'
  47. import { getDataDictionary } from '@/api/dataDictionary.js'
  48. import operation_mixin from '@/components/template/operation_mixin.js'
  49. import { getWebsit } from '@/api/customerManagement.js'
  50. export default {
  51. props: {
  52. storageType: {
  53. type: String,
  54. default: ''
  55. }
  56. },
  57. components: { TemplatePage },
  58. mixins: [import_mixin, operation_mixin],
  59. data() {
  60. return {
  61. // 表格属性
  62. tableAttributes: {
  63. // 启用勾选列
  64. selectColumn: false
  65. },
  66. // 表格事件
  67. tableEvents: {
  68. 'selection-change': this.selectionChange
  69. },
  70. // 勾选选中数据
  71. recordSelected: [],
  72. formData: {
  73. companyWechatId: '',
  74. companyWechatName: '',
  75. intro: '',
  76. reason: '',
  77. remark: '',
  78. status: true,
  79. type: '',
  80. usedType: '',
  81. pgIncreItems: [],
  82. pgIncreWebsits: []
  83. },
  84. formDialog: false,
  85. isEditIndex: -1,
  86. orderBrands: [],
  87. classifyList: [],
  88. classifyListLv2: [],
  89. clickLook: true,
  90. websitList: [],
  91. websitIndex: -1
  92. }
  93. },
  94. computed: {
  95. // 事件组合
  96. optionsEvensGroup() {
  97. return [
  98. [
  99. [
  100. this.optionsEvensAuth('add', {
  101. click: () => {
  102. this.openForm()
  103. }
  104. })
  105. ]
  106. ]
  107. ]
  108. },
  109. // 更多参数
  110. moreParameters() {
  111. return []
  112. },
  113. columns() {
  114. return [
  115. {
  116. columnAttributes: {
  117. label: '品牌',
  118. prop: 'brandId'
  119. },
  120. render: (h, { row, column, index }) => {
  121. return this.isEditIndex == index ? (
  122. <div class="redbordererr">
  123. <el-form-item
  124. label=""
  125. label-width="0px"
  126. prop={`pgIncreItems.${index}.${column.columnAttributes.prop}`}
  127. rules={required}
  128. >
  129. <el-select
  130. value={row[column.columnAttributes.prop]}
  131. onInput={val => {
  132. row[column.columnAttributes.prop] = val
  133. }}
  134. onChange={val => {
  135. if (val) {
  136. var data = this.orderBrands.find(item => item.value == val)
  137. row.brandName = data.label
  138. } else {
  139. row.brandName = ''
  140. }
  141. }}
  142. placeholder="请选择"
  143. >
  144. {this.orderBrands.map((item, index_) => (
  145. <el-option key={index_} label={item.label} value={item.value}></el-option>
  146. ))}
  147. </el-select>
  148. </el-form-item>
  149. </div>
  150. ) : (
  151. <div style="padding-left:10px">{row.brandName}</div>
  152. )
  153. }
  154. },
  155. {
  156. columnAttributes: {
  157. label: '产品大类',
  158. prop: 'mainId'
  159. },
  160. render: (h, { row, column, index }) => {
  161. return this.isEditIndex == index ? (
  162. <div class="redbordererr">
  163. <el-form-item
  164. label=""
  165. label-width="0px"
  166. prop={`pgIncreItems.${index}.${column.columnAttributes.prop}`}
  167. rules={required}
  168. >
  169. <el-select
  170. value={row[column.columnAttributes.prop]}
  171. onInput={val => {
  172. row[column.columnAttributes.prop] = val
  173. }}
  174. onChange={val => {
  175. if (val) {
  176. var data = this.classifyList.find(item => item.categoryId == val)
  177. row.mainName = data.name
  178. } else {
  179. row.mainName = ''
  180. }
  181. }}
  182. placeholder="请选择"
  183. >
  184. {this.classifyList.map((item, index_) => (
  185. <el-option key={index_} label={item.name} value={item.categoryId}></el-option>
  186. ))}
  187. </el-select>
  188. </el-form-item>
  189. </div>
  190. ) : (
  191. <div style="padding-left:10px">{row.mainName}</div>
  192. )
  193. }
  194. },
  195. {
  196. columnAttributes: {
  197. label: '服务内容',
  198. prop: 'content'
  199. },
  200. render: (h, { row, column, index }) => {
  201. return this.isEditIndex == index ? (
  202. <div class="redbordererr">
  203. <el-form-item
  204. label=""
  205. label-width="0px"
  206. prop={`pgIncreItems.${index}.${column.columnAttributes.prop}`}
  207. rules={required}
  208. >
  209. <el-input
  210. value={row[column.columnAttributes.prop]}
  211. onInput={val => {
  212. row[column.columnAttributes.prop] = val
  213. }}
  214. placeholder="请输入内容"
  215. ></el-input>
  216. </el-form-item>
  217. </div>
  218. ) : (
  219. <div style="padding-left:10px">{row[column.columnAttributes.prop]}</div>
  220. )
  221. }
  222. },
  223. {
  224. columnAttributes: {
  225. label: '使用限值',
  226. prop: 'limitNum'
  227. },
  228. render: (h, { row, column, index }) => {
  229. return this.isEditIndex == index ? (
  230. <div class="redbordererr">
  231. <el-form-item
  232. label=""
  233. label-width="0px"
  234. prop={`pgIncreItems.${index}.${column.columnAttributes.prop}`}
  235. rules={required}
  236. >
  237. <el-input
  238. value={row[column.columnAttributes.prop]}
  239. onInput={val => {
  240. row[column.columnAttributes.prop] = val
  241. }}
  242. placeholder="请输入内容"
  243. ></el-input>
  244. </el-form-item>
  245. </div>
  246. ) : (
  247. <div style="padding-left:10px">{row[column.columnAttributes.prop]}</div>
  248. )
  249. }
  250. },
  251. {
  252. columnAttributes: {
  253. label: '服务金额(元)',
  254. prop: 'amount'
  255. },
  256. render: (h, { row, column, index }) => {
  257. return this.isEditIndex == index ? (
  258. <div class="redbordererr">
  259. <el-form-item
  260. label=""
  261. label-width="0px"
  262. prop={`pgIncreItems.${index}.${column.columnAttributes.prop}`}
  263. rules={required}
  264. >
  265. <el-input
  266. type="number"
  267. value={row[column.columnAttributes.prop]}
  268. onInput={val => {
  269. row[column.columnAttributes.prop] = val
  270. if (val && row.workerAmount && Number(row.workerAmount) > Number(val)) {
  271. row.workerAmount = val
  272. }
  273. }}
  274. placeholder="请输入内容"
  275. ></el-input>
  276. </el-form-item>
  277. </div>
  278. ) : (
  279. <div style="padding-left:10px">{row[column.columnAttributes.prop]}</div>
  280. )
  281. }
  282. },
  283. {
  284. columnAttributes: {
  285. label: '师傅分成金额',
  286. prop: 'workerAmount'
  287. },
  288. render: (h, { row, column, index }) => {
  289. return this.isEditIndex == index ? (
  290. <div class="redbordererr">
  291. <el-form-item
  292. label=""
  293. label-width="0px"
  294. prop={`pgIncreItems.${index}.${column.columnAttributes.prop}`}
  295. rules={required}
  296. >
  297. <el-input
  298. type="number"
  299. value={row[column.columnAttributes.prop]}
  300. onInput={val => {
  301. row[column.columnAttributes.prop] =
  302. val && row.amount && Number(val) > Number(row.amount) ? row.amount : val
  303. }}
  304. placeholder="请输入内容"
  305. ></el-input>
  306. </el-form-item>
  307. </div>
  308. ) : (
  309. <div style="padding-left:10px">{row[column.columnAttributes.prop]}</div>
  310. )
  311. }
  312. },
  313. {
  314. columnAttributes: {
  315. label: '网点分成金额',
  316. prop: 'websitAmount'
  317. },
  318. render: (h, { row, column, index }) => {
  319. row[column.columnAttributes.prop] = (Number(row['amount']) - Number(row['workerAmount'])).toFixed(2)
  320. return <div style="padding-left:10px">{row[column.columnAttributes.prop]}</div>
  321. }
  322. },
  323. {
  324. columnAttributes: {
  325. label: '创建人',
  326. prop: 'createBy'
  327. }
  328. },
  329. {
  330. columnAttributes: {
  331. label: '创建时间',
  332. prop: 'createTime'
  333. }
  334. },
  335. {
  336. columnAttributes: {
  337. label: '修改人',
  338. prop: 'updateBy'
  339. }
  340. },
  341. {
  342. columnAttributes: {
  343. label: '修改时间',
  344. prop: 'updateTime'
  345. }
  346. },
  347. {
  348. columnAttributes: {
  349. label: '操作'
  350. },
  351. render: (h, { row, column, index }) => {
  352. return (
  353. <div style="padding-left:10px">
  354. <el-button
  355. type="text"
  356. onClick={() => {
  357. if (this.isEditIndex === index) {
  358. this.isEditIndex = -1
  359. }
  360. this.formData.pgIncreItems.splice(index, 1)
  361. }}
  362. >
  363. 删除
  364. </el-button>
  365. {this.isEditIndex == index && (
  366. <el-button
  367. type="text"
  368. onClick={() => {
  369. if (this.panduancp()) {
  370. this.$refs.formRef.validateField(this.getVfyKey(index), (valid, invalidFields, errLabels) => {
  371. if (valid) {
  372. this.isEditIndex = -1
  373. }
  374. })
  375. }
  376. }}
  377. >
  378. 确定
  379. </el-button>
  380. )}
  381. {this.isEditIndex == -1 && (
  382. <el-button
  383. type="text"
  384. onClick={() => {
  385. this.isEditIndex = index
  386. }}
  387. >
  388. 编辑
  389. </el-button>
  390. )}
  391. </div>
  392. )
  393. }
  394. }
  395. ]
  396. },
  397. formItems() {
  398. return [
  399. {
  400. name: 'slot-component',
  401. md: 16,
  402. formItemAttributes: { label: '', prop: '' },
  403. render: (h, { props }) => {
  404. return null
  405. }
  406. },
  407. {
  408. name: 'el-select',
  409. md: 8,
  410. options: [
  411. { label: '延保', value: 1 },
  412. { label: '清洗', value: 2 }
  413. ],
  414. attributes: {
  415. placeholder: '请选择',
  416. clearable: true,
  417. filterable: true
  418. },
  419. formItemAttributes: {
  420. label: '服务类型',
  421. prop: 'type',
  422. rules: [...required]
  423. },
  424. events: {
  425. change: val => {
  426. if (val == 1) {
  427. this.formData.usedType = 'YEAR'
  428. }
  429. }
  430. }
  431. },
  432. {
  433. name: 'slot-component',
  434. md: 16,
  435. formItemAttributes: { label: '', prop: '' },
  436. render: (h, { props }) => {
  437. return null
  438. }
  439. },
  440. {
  441. name: 'el-select',
  442. md: 8,
  443. options: [
  444. { label: '使用次数', value: 'COUNT' },
  445. { label: '使用年限', value: 'YEAR' }
  446. ],
  447. attributes: {
  448. placeholder: '请选择',
  449. clearable: true,
  450. filterable: true,
  451. disabled: this.formData.type == 1
  452. },
  453. formItemAttributes: {
  454. label: '使用类型',
  455. prop: 'usedType',
  456. rules: [...required]
  457. }
  458. },
  459. {
  460. name: 'slot-component',
  461. md: 16,
  462. formItemAttributes: { label: '', prop: '' },
  463. render: (h, { props }) => {
  464. return null
  465. }
  466. },
  467. {
  468. name: 'el-input',
  469. md: 8,
  470. name: 'el-radio',
  471. options: [
  472. { label: '上架', value: true },
  473. { label: '下架', value: false }
  474. ],
  475. formItemAttributes: {
  476. label: '状态',
  477. prop: 'status',
  478. rules: [...required]
  479. }
  480. },
  481. {
  482. md: 24,
  483. isShow: true,
  484. name: 'slot-component',
  485. formItemAttributes: {
  486. label: '服务内容',
  487. prop: 'pgIncreItems',
  488. rules: [...required]
  489. },
  490. render: (h, { props, onInput }) => {
  491. var { value } = props
  492. return (
  493. <div>
  494. <div style="margin-bottom:8px">
  495. <el-button
  496. onClick={() => {
  497. if (this.panduancp()) {
  498. if (this.formData.pgIncreItems.length == 0) {
  499. this.formData.pgIncreItems.push({
  500. amount: '',
  501. brandId: '',
  502. brandName: '',
  503. content: '',
  504. limitNum: '',
  505. mainId: '',
  506. mainName: '',
  507. websitAmount: '',
  508. workerAmount: ''
  509. })
  510. this.isEditIndex = this.formData.pgIncreItems.length - 1
  511. } else {
  512. this.$refs.formRef.validateField(
  513. this.getVfyKey(this.isEditIndex),
  514. (valid, invalidFields, errLabels) => {
  515. if (valid) {
  516. this.formData.pgIncreItems.push({
  517. amount: '',
  518. brandId: '',
  519. brandName: '',
  520. content: '',
  521. limitNum: '',
  522. mainId: '',
  523. mainName: '',
  524. websitAmount: '',
  525. workerAmount: ''
  526. })
  527. this.isEditIndex = this.formData.pgIncreItems.length - 1
  528. }
  529. }
  530. )
  531. }
  532. }
  533. }}
  534. >
  535. 添加
  536. </el-button>
  537. </div>
  538. <zj-table
  539. columns={this.columns}
  540. tableData={this.formData.pgIncreItems}
  541. tableAttributes={{
  542. size: 'mini',
  543. border: true
  544. }}
  545. />
  546. </div>
  547. )
  548. }
  549. },
  550. {
  551. name: 'el-input',
  552. md: 24,
  553. attributes: {
  554. disabled: false,
  555. placeholder: '请输入',
  556. type: 'textarea',
  557. autosize: { minRows: 2, maxRows: 4 },
  558. maxlength: 50,
  559. 'show-word-limit': true
  560. },
  561. formItemAttributes: {
  562. label: '服务介绍',
  563. prop: 'intro',
  564. rules: [...required]
  565. }
  566. },
  567. {
  568. md: 24,
  569. name: 'slot-component',
  570. formItemAttributes: {
  571. label: '服务说明',
  572. prop: 'reason',
  573. rules: [...required]
  574. },
  575. render: (h, { props, onInput }) => {
  576. var { value } = props
  577. return <v-quill-editor value={value} onInput={onInput} />
  578. }
  579. },
  580. {
  581. md: 24,
  582. name: 'slot-component',
  583. formItemAttributes: {
  584. label: '服务网点',
  585. prop: 'pgIncreWebsits',
  586. rules: [...required]
  587. },
  588. render: (h, { props, onInput }) => {
  589. var { value } = props
  590. return (
  591. <div>
  592. <div style="margin-bottom:8px">
  593. <el-button
  594. onClick={() => {
  595. this.formData.pgIncreWebsits.push({
  596. websitId: '',
  597. linkName: '',
  598. websitPhone: '',
  599. address: ''
  600. })
  601. this.websitIndex = this.formData.pgIncreWebsits.length - 1
  602. }}
  603. >
  604. 添加
  605. </el-button>
  606. </div>
  607. <zj-table
  608. columns={[
  609. {
  610. columnAttributes: {
  611. label: '网点名称',
  612. prop: 'websitId'
  613. },
  614. render: (h, { row, column, index }) => {
  615. return (
  616. <div>
  617. <el-form-item
  618. label=""
  619. label-width="0px"
  620. prop={`pgIncreWebsits.${index}.${column.columnAttributes.prop}`}
  621. rules={required}
  622. >
  623. <el-select
  624. value={row[column.columnAttributes.prop]}
  625. onInput={val => {
  626. row[column.columnAttributes.prop] = val
  627. }}
  628. disabled={!(this.websitIndex == index)}
  629. onChange={val => {
  630. if (val) {
  631. var data = this.websitList.find(item => item.value == val)
  632. row.linkName = data.data.linkName
  633. row.websitPhone = data.data.websitPhone
  634. row.address = data.data.address
  635. } else {
  636. row.linkName = ''
  637. row.websitPhone = ''
  638. row.address = ''
  639. }
  640. }}
  641. placeholder="请选择"
  642. >
  643. {this.websitList
  644. .filter(
  645. item =>
  646. row.websitId == item.value ||
  647. !this.formData.pgIncreWebsits.find(val => val.websitId == item.value)
  648. )
  649. .map((item, index_) => (
  650. <el-option key={index_} label={item.label} value={item.value}></el-option>
  651. ))}
  652. </el-select>
  653. </el-form-item>
  654. </div>
  655. )
  656. }
  657. },
  658. {
  659. columnAttributes: {
  660. label: '联系人',
  661. prop: 'linkName'
  662. }
  663. },
  664. {
  665. columnAttributes: {
  666. label: '联系电话',
  667. prop: 'websitPhone'
  668. }
  669. },
  670. {
  671. columnAttributes: {
  672. label: '地址',
  673. prop: 'address'
  674. }
  675. },
  676. {
  677. columnAttributes: {
  678. label: '操作'
  679. },
  680. render: (h, { row, column, index }) => {
  681. return (
  682. <div style="padding-left:10px">
  683. {this.websitIndex == index ? (
  684. <el-button
  685. type="text"
  686. onClick={() => {
  687. this.websitIndex = -1
  688. }}
  689. >
  690. 确定
  691. </el-button>
  692. ) : null}
  693. {this.websitIndex != index ? (
  694. <el-button
  695. type="text"
  696. onClick={() => {
  697. this.websitIndex = index
  698. }}
  699. >
  700. 编辑
  701. </el-button>
  702. ) : null}
  703. <el-button
  704. type="text"
  705. onClick={() => {
  706. if (this.websitIndex == index) {
  707. this.websitIndex = -1
  708. }
  709. this.formData.pgIncreWebsits.splice(index, 1)
  710. }}
  711. >
  712. 删除
  713. </el-button>
  714. </div>
  715. )
  716. }
  717. }
  718. ]}
  719. tableData={this.formData.pgIncreWebsits}
  720. tableAttributes={{
  721. size: 'mini',
  722. border: true
  723. }}
  724. />
  725. </div>
  726. )
  727. }
  728. },
  729. {
  730. name: 'el-input',
  731. md: 24,
  732. attributes: { disabled: false, placeholder: '请输入', type: 'textarea' },
  733. formItemAttributes: {
  734. label: '备注',
  735. prop: 'remark',
  736. rules: []
  737. }
  738. }
  739. ]
  740. }
  741. },
  742. methods: {
  743. // 列表请求函数
  744. getList: increConfigList,
  745. // 列表导出函数
  746. exportList: increConfigListExport,
  747. // 表格列解析渲染数据更改
  748. columnParsing(item, defaultData) {
  749. return defaultData
  750. },
  751. // 监听勾选变化
  752. selectionChange(data) {
  753. this.recordSelected = data
  754. },
  755. // 表格操作列
  756. operation() {
  757. return this.operationBtn({
  758. detail: {
  759. btnType: 'text',
  760. click: ({ row, index, column }) => {
  761. this.getDetail(row.id)
  762. }
  763. }
  764. })
  765. },
  766. panduancp() {
  767. try {
  768. this.formData.pgIncreItems.map((row, index) => {
  769. this.formData.pgIncreItems.map((item, index_) => {
  770. if (
  771. `${row.brandId}_${row.mainId}_${row.content}` == `${item.brandId}_${item.mainId}_${item.content}` &&
  772. index_ != index
  773. ) {
  774. throw new Error('')
  775. }
  776. })
  777. })
  778. } catch (error) {
  779. this.$message.warning('服务内容重复')
  780. return false
  781. }
  782. return true
  783. },
  784. getDetail(id) {
  785. increConfigDetail({ id }).then(res => {
  786. Object.assign(this.formData, res.data, {
  787. pgIncreWebsits: res.data.pgIncreWebsits || []
  788. })
  789. this.openForm()
  790. })
  791. },
  792. getVfyKey(index, bool = true) {
  793. return [
  794. ...(() => {
  795. if (bool) {
  796. return [`pgIncreItems`]
  797. }
  798. return []
  799. })(),
  800. ...(() => {
  801. if (index > -1) {
  802. return [
  803. `pgIncreItems.${index}.brandId`,
  804. `pgIncreItems.${index}.mainId`,
  805. `pgIncreItems.${index}.content`,
  806. `pgIncreItems.${index}.limitNum`,
  807. `pgIncreItems.${index}.amount`,
  808. `pgIncreItems.${index}.websitAmount`,
  809. `pgIncreItems.${index}.workerAmount`
  810. ]
  811. }
  812. return []
  813. })()
  814. ]
  815. },
  816. openForm() {
  817. Promise.all([
  818. getDataDictionary({
  819. pageNum: 1,
  820. pageSize: -1,
  821. params: [
  822. { param: 'a.status', compare: '=', value: 'ON' },
  823. { param: 'a.dict_type', compare: '=', value: 'BRAND' }
  824. ]
  825. }),
  826. getClassifyList({ type: 2, status: true }),
  827. getWebsit({ isIncre: true, status: true })
  828. ]).then(([res1, res2, res3]) => {
  829. // 获取品牌
  830. this.orderBrands = res1.data.records.map(item => ({
  831. value: item.dictCode,
  832. label: item.dictValue
  833. }))
  834. // 获取产品大类小类
  835. var classifyListLv2 = []
  836. this.classifyList = res2.data.map(item => {
  837. var { children, ...data } = item
  838. classifyListLv2.push(...(children || []))
  839. return {
  840. ...data
  841. }
  842. })
  843. this.classifyListLv2 = classifyListLv2
  844. this.websitList = res3.data.map(item => ({
  845. label: item.name,
  846. value: item.websitId,
  847. data: item
  848. }))
  849. var { companyWechatId, companyName } = JSON.parse(localStorage.getItem('greemall_user'))
  850. this.formData.companyWechatId = companyWechatId
  851. this.formData.companyWechatName = companyName
  852. // 打开弹窗
  853. this.formDialog = true
  854. })
  855. },
  856. // 关闭弹窗
  857. formCancel() {
  858. this.$refs.formRef.$refs.inlineForm.clearValidate()
  859. this.$data.formData = this.$options.data().formData
  860. this.isEditIndex = -1
  861. this.formDialog = false
  862. },
  863. formConfirm() {
  864. if (this.clickLook && this.panduancp()) {
  865. this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
  866. if (valid) {
  867. this.clickLook = false
  868. ;[increConfigAdd, increConfigUpdate]
  869. [this.formData.id ? 1 : 0]({
  870. ...this.formData
  871. })
  872. .then(res => {
  873. this.$message({ type: 'success', message: `成功!` })
  874. this.formCancel()
  875. this.$refs.pageRef.refreshList()
  876. this.clickLook = true
  877. })
  878. .catch(() => {
  879. this.clickLook = true
  880. })
  881. }
  882. })
  883. } else {
  884. this.$message.warning('服务内容没有确认')
  885. }
  886. }
  887. }
  888. }
  889. </script>
  890. <style lang="scss">
  891. .redbordererr {
  892. .el-form-item {
  893. margin: 0 !important;
  894. overflow: hidden;
  895. }
  896. }
  897. </style>