detailsPage.vue 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192
  1. <template>
  2. <div>
  3. <div class="borderless">
  4. <div class="customer-head">
  5. <div class="customer-back">
  6. <el-button
  7. type="danger"
  8. style="border: none; background: none; color: red"
  9. icon="el-icon-arrow-left"
  10. @click="backToList"
  11. >返回列表
  12. </el-button>
  13. </div>
  14. <div class="add-customer-btn">
  15. <el-button type="primary" size="small" @click="editCustomer"> 保存数据 </el-button>
  16. <el-button
  17. v-if="form.id && (form.checkStatus == '录入' || form.checkStatus == '审核驳回')"
  18. class="el-button--small-yh"
  19. style="margin-left: 6px"
  20. type="success"
  21. size="small"
  22. @click="allClick('提交审批')"
  23. >提交审批
  24. </el-button>
  25. <el-button
  26. v-if="form.id && form.checkStatus == '提交'"
  27. class="el-button--small-yh"
  28. style="margin-left: 6px"
  29. type="success"
  30. size="small"
  31. @click="allClick('审批')"
  32. >审批
  33. </el-button>
  34. <el-button
  35. class="el-button--small-yh"
  36. :type="form.enableOrNot == 0 ? 'primary' : ''"
  37. size="small"
  38. v-if="form.id"
  39. @click="editEnable"
  40. >
  41. {{ form.enableOrNot == 0 ? "启用" : "禁用" }}
  42. </el-button>
  43. </div>
  44. </div>
  45. <trade-card title="基础资料" style="margin-top: 60px" v-loading="loadingBtn">
  46. <avue-form ref="form" class="trading-form" v-model="form" :option="option" :upload-after="uploadAfter">
  47. <template slot="corpsTypeIdLabel">
  48. <span style="color: #409eff; cursor: pointer" @click="corpTypeVisible = true"> 店面分类 </span>
  49. </template>
  50. <template slot="corpsTypeId">
  51. <avue-input-tree
  52. v-model="form.corpsTypeId"
  53. :disabled="option.disabled"
  54. placeholder="请选择店面分类"
  55. :dic="corpTypeList"
  56. :props="props"
  57. >
  58. </avue-input-tree>
  59. </template>
  60. <tempalte slot="salesmanName">
  61. <dic-select
  62. v-model="form.salesmanName"
  63. placeholder="业务员"
  64. label="name"
  65. @selectChange="dicChange('salesmanName', $event)"
  66. :disabled="option.disabled"
  67. url="/blade-user/salerList"
  68. :filterable="true"
  69. dataName="name"
  70. >
  71. </dic-select>
  72. </tempalte>
  73. <tempalte slot="deliveryWarehouseName">
  74. <dic-select
  75. v-model="form.deliveryWarehouseName"
  76. placeholder="发货仓库"
  77. label="cname"
  78. res="records"
  79. url="/gubersail-admin/storageDesc/list?current=1&size=5"
  80. :filterable="true"
  81. :remote="true"
  82. dataName="cname"
  83. @selectChange="dicChange('deliveryWarehouseName', $event)"
  84. :disabled="option.disabled"
  85. ></dic-select>
  86. </tempalte>
  87. <tempalte slot="label">
  88. <dic-select
  89. :key="labelKey"
  90. v-model="form.label"
  91. placeholder="门店标签"
  92. label="label"
  93. res="records"
  94. url="/gubersail-admin/corpslabel/list?current=1&size=5"
  95. :filterable="true"
  96. :remote="true"
  97. dataName="label"
  98. :disabled="option.disabled"
  99. @selectChange="dicChange('label', $event)"
  100. :multiple="true"
  101. dataType="string"
  102. ></dic-select>
  103. </tempalte>
  104. <tempalte slot="brandName">
  105. <dic-select
  106. v-model="form.brandName"
  107. placeholder="品牌"
  108. label="cname"
  109. url="/gubersail-admin/brandDesc/listAllV1?type=PP"
  110. :filterable="true"
  111. @selectChange="dicChange('brandName', $event)"
  112. :multiple="true"
  113. :disabled="option.disabled"
  114. dataType="string"
  115. ></dic-select>
  116. </tempalte>
  117. <template slot="labelLabel">
  118. <span style="color: #409eff; cursor: pointer" @click="labelVisible = true"> 门店标签 </span>
  119. </template>
  120. </avue-form>
  121. </trade-card>
  122. <trade-card title="客户联系人" v-loading="loadingBtn">
  123. <avue-crud
  124. ref="crudTwo"
  125. :option="customerContactBack"
  126. v-model="contactsForm"
  127. :data="contactsData"
  128. @row-save="rowSave"
  129. @row-update="rowUpdate"
  130. @row-del="rowDelTwo"
  131. >
  132. <template slot="menuLeft">
  133. <el-button
  134. type="primary"
  135. icon="el-icon-plus"
  136. size="small"
  137. @click.stop="$refs.crudTwo.rowAdd()"
  138. :disabled="option.disabled"
  139. >录入明细
  140. </el-button>
  141. </template>
  142. <template slot-scope="{ type, size, row, disabled, index }" slot="menu">
  143. <el-button
  144. :size="size"
  145. :disabled="option.disabled"
  146. :type="type"
  147. :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
  148. @click="$refs.crudTwo.rowEdit(row, index)"
  149. >{{ row.$cellEdit ? "确认" : "修改" }}
  150. </el-button>
  151. <el-button
  152. icon="el-icon-delete"
  153. :size="size"
  154. :disabled="option.disabled"
  155. :type="type"
  156. @click="rowDelTwo(row, index)"
  157. >删除
  158. </el-button>
  159. <el-button
  160. icon="el-icon-check"
  161. :size="size"
  162. :type="type"
  163. @click="creatingUsers(row)"
  164. :disabled="option.disabled"
  165. >创建用户
  166. </el-button>
  167. </template>
  168. </avue-crud>
  169. </trade-card>
  170. <trade-card title="地址信息" v-loading="loadingBtn">
  171. <avue-crud :option="option2" ref="crud" :data="data" @row-save="rowSave" @row-update="rowUpdate">
  172. <template slot="headerSerial">
  173. <el-button
  174. type="primary"
  175. icon="el-icon-plus"
  176. size="mini"
  177. @click.stop="addRow"
  178. :disabled="detailData.status == 1"
  179. circle
  180. ></el-button>
  181. </template>
  182. <template slot="menuLeft">
  183. <el-button type="primary" icon="el-icon-plus" size="small" @click.stop="addRow" :disabled="option.disabled"
  184. >录入明细
  185. </el-button>
  186. </template>
  187. <template v-if="!row.$cellEdit" slot-scope="{ type, size, row, index, disabled }" slot="menu">
  188. <el-button
  189. :size="size"
  190. :disabled="option.disabled"
  191. :type="type"
  192. :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
  193. @click="$refs.crud.rowCell(row, index)"
  194. >{{ row.$cellEdit ? "确认" : "修改" }}
  195. </el-button>
  196. <el-button
  197. icon="el-icon-delete"
  198. :size="size"
  199. :disabled="option.disabled"
  200. :type="type"
  201. @click="rowDel(row, index)"
  202. >删除
  203. </el-button>
  204. </template>
  205. <template slot="defaultAddres" slot-scope="{ row, index, disabled }">
  206. <el-switch
  207. active-value="1"
  208. inactive-value="0"
  209. :disabled="option.disabled"
  210. v-model="row.defaultAddres"
  211. @change="addressUnique(row, index)"
  212. >
  213. </el-switch>
  214. </template>
  215. </avue-crud>
  216. </trade-card>
  217. <containerTitle title="店面照片"></containerTitle>
  218. <c-upload
  219. v-loading="loadingBtn"
  220. typeUpload="CD"
  221. deleteUrl="/api/gubersail-admin/corpsfiles/remove"
  222. :data="corpsFiles"
  223. display
  224. :enumerationValue="35.1"
  225. :disabled="option.disabled"
  226. :mainImageType="true"
  227. ></c-upload>
  228. <el-dialog
  229. title="设置店面分类"
  230. v-dialogDrag
  231. :visible.sync="corpTypeVisible"
  232. class="avue-dialog"
  233. width="80%"
  234. append-to-body
  235. @closed="corpTypeClosed"
  236. >
  237. <span>
  238. <corp-type v-if="corpTypeVisible"></corp-type>
  239. </span>
  240. <div class="avue-dialog__footer">
  241. <el-button @click="corpTypeVisible = false" size="mini">取 消</el-button>
  242. <el-button @click="addCorpType" type="primary" size="mini">确 定</el-button>
  243. </div>
  244. </el-dialog>
  245. </div>
  246. <el-dialog
  247. title="设置门店标签"
  248. v-dialogDrag
  249. :visible.sync="labelVisible"
  250. class="avue-dialog"
  251. width="80%"
  252. append-to-body
  253. @closed="labelClosed"
  254. >
  255. <span>
  256. <corp-label v-if="labelVisible"></corp-label>
  257. </span>
  258. <div class="avue-dialog__footer">
  259. <el-button @click="labelVisible = false" size="mini">取 消</el-button>
  260. <el-button @click="addLabel" type="primary" size="mini">确 定</el-button>
  261. </div>
  262. </el-dialog>
  263. <el-dialog title="创建用户" :visible.sync="dialogVisibleBt" append-to-body width="60%">
  264. <avue-form v-if="dialogVisibleBt" ref="formDataTwo" v-model="formDataTwo" :option="optionData"> </avue-form>
  265. <span slot="footer" class="dialog-footer">
  266. <el-button @click="dialogVisibleBt = false">取 消</el-button>
  267. <el-button type="primary" @click="confirmSynchronizationTwo">确 定</el-button>
  268. </span>
  269. </el-dialog>
  270. </div>
  271. </template>
  272. <script>
  273. // @ts-nocheck
  274. import {
  275. getDetails,
  276. getCorpType,
  277. submit,
  278. customerList,
  279. areaTypeTree,
  280. itemDel,
  281. corpsattn,
  282. editenable,
  283. getUserByRole,
  284. getBrandDesc,
  285. creatingUsersTwo,
  286. submitApply,
  287. review,
  288. } from "@/api/store/customerInformation";
  289. import { getRoleTree } from "@/api/system/role";
  290. import { getDeptTree } from "@/api/system/dept";
  291. import { getPostList } from "@/api/system/post";
  292. import corpType from "./components/index.vue";
  293. import corpLabel from "./components/label.vue";
  294. import website from "@/config/website";
  295. import dicSelect from "@/components/dicSelect/main.vue";
  296. import { getToken } from "@/util/auth";
  297. export default {
  298. name: "index",
  299. data() {
  300. return {
  301. labelKey: Date.now(),
  302. labelVisible: false,
  303. propsCk: {
  304. label: "cname",
  305. value: "id",
  306. },
  307. props: {
  308. label: "title",
  309. value: "value",
  310. },
  311. optionData: {
  312. span: 8,
  313. menuBtn: false,
  314. column: [
  315. {
  316. label: "所属角色",
  317. prop: "roleId",
  318. multiple: true,
  319. type: "tree",
  320. dicData: [],
  321. props: {
  322. label: "title",
  323. },
  324. checkStrictly: true,
  325. slot: true,
  326. rules: [
  327. {
  328. required: true,
  329. message: "请选择所属角色",
  330. trigger: "click",
  331. },
  332. ],
  333. },
  334. {
  335. label: "所属部门",
  336. prop: "deptId",
  337. type: "tree",
  338. multiple: true,
  339. dicData: [],
  340. props: {
  341. label: "title",
  342. },
  343. checkStrictly: true,
  344. slot: true,
  345. rules: [
  346. {
  347. required: true,
  348. message: "请选择所属部门",
  349. trigger: "click",
  350. },
  351. ],
  352. },
  353. {
  354. label: "所属岗位",
  355. prop: "postId",
  356. type: "tree",
  357. multiple: true,
  358. dicData: [],
  359. props: {
  360. label: "postName",
  361. value: "id",
  362. },
  363. rules: [
  364. {
  365. required: true,
  366. message: "请选择所属岗位",
  367. trigger: "click",
  368. },
  369. ],
  370. },
  371. ],
  372. },
  373. dialogVisibleBt: false,
  374. formDataTwo: false,
  375. customerContact: {},
  376. contactsForm: {},
  377. contactsData: [],
  378. corpTypeList: [],
  379. corpTypeVisible: false,
  380. loadingBtn: false,
  381. form: {
  382. ifLimitAmount: "0",
  383. },
  384. form4: {},
  385. data: [],
  386. data2: [],
  387. option: {
  388. menuBtn: false,
  389. span: 6,
  390. column: [
  391. {
  392. label: "店铺名称",
  393. prop: "cname",
  394. rules: [
  395. {
  396. required: true,
  397. message: "",
  398. trigger: "blur",
  399. },
  400. ],
  401. },
  402. {
  403. label: "店面分类",
  404. prop: "corpsTypeId",
  405. rules: [
  406. {
  407. required: true,
  408. message: " ",
  409. trigger: "blur",
  410. },
  411. ],
  412. },
  413. {
  414. label: "电话",
  415. prop: "tel",
  416. rules: [
  417. {
  418. required: true,
  419. message: " ",
  420. trigger: "blur",
  421. },
  422. ],
  423. },
  424. {
  425. label: "业务员",
  426. prop: "salesmanName",
  427. rules: [
  428. {
  429. required: true,
  430. message: " ",
  431. trigger: "blur",
  432. },
  433. ],
  434. },
  435. {
  436. label: "发货仓库",
  437. prop: "deliveryWarehouseName",
  438. rules: [
  439. {
  440. required: true,
  441. message: " ",
  442. trigger: "blur",
  443. },
  444. ],
  445. },
  446. {
  447. label: "商城价格",
  448. prop: "priceSystem",
  449. filterable: true,
  450. type: "select",
  451. dicUrl: "/api/blade-system/dict-biz/dictionary?code=mall_price",
  452. props: {
  453. label: "dictValue",
  454. value: "dictKey",
  455. },
  456. rules: [
  457. {
  458. required: true,
  459. message: " ",
  460. trigger: "blur",
  461. },
  462. ],
  463. },
  464. {
  465. label: "积分余额",
  466. prop: "pointsBalance",
  467. type: "number",
  468. controls: false,
  469. precision: 2,
  470. disabled: true,
  471. },
  472. {
  473. label: "品牌",
  474. prop: "brandName",
  475. rules: [
  476. {
  477. message: "请选择品牌",
  478. trigger: "click",
  479. },
  480. ],
  481. },
  482. {
  483. label: "门店标签",
  484. prop: "label",
  485. },
  486. {
  487. label: "店面属性",
  488. prop: "storeAttributes",
  489. type: "select",
  490. dicUrl: "/api/blade-system/dict-biz/dictionary?code=storeAttributes",
  491. props: {
  492. label: "dictValue",
  493. value: "dictKey",
  494. },
  495. },
  496. {
  497. label: "连锁属性",
  498. prop: "chainAttribute",
  499. type: "select",
  500. dicUrl: "/api/blade-system/dict-biz/dictionary?code=chainAttribute",
  501. props: {
  502. label: "dictValue",
  503. value: "dictKey",
  504. },
  505. },
  506. {
  507. label: "签约级别",
  508. prop: "signingLevel",
  509. type: "select",
  510. dicUrl: "/api/blade-system/dict-biz/dictionary?code=signingLevel",
  511. props: {
  512. label: "dictValue",
  513. value: "dictKey",
  514. },
  515. },
  516. {
  517. label: "签约条数",
  518. prop: "signingNumber",
  519. },
  520. {
  521. label: "签约期限起",
  522. prop: "signingPeriodStart",
  523. type: "month",
  524. format: "yyyy-MM",
  525. valueFormat: "yyyy-MM-01 00:00:00",
  526. },
  527. {
  528. label: "签约期限止",
  529. prop: "signingPeriodEnd",
  530. type: "month",
  531. format: "yyyy-MM",
  532. valueFormat: "yyyy-MM-01 00:00:00",
  533. },
  534. {
  535. label: "备注",
  536. prop: "remarks",
  537. type: "textarea",
  538. minRows: 2,
  539. },
  540. {
  541. label: "营业执照",
  542. prop: "businessLicenseUrl",
  543. type: "upload",
  544. listType: "picture-img",
  545. fileType: "img", //img/video/audio
  546. propsHttp: {
  547. res: "data",
  548. url: "link",
  549. },
  550. action: "/api/blade-resource/oss/endpoint/put-file",
  551. headers: { "Blade-Auth": "Bearer " + getToken() },
  552. },
  553. ],
  554. },
  555. option2: {
  556. align: "center",
  557. index: true,
  558. addBtnText: "录入明细",
  559. refreshBtn: false,
  560. dialogDrag: true,
  561. addBtn: false,
  562. span: 8,
  563. height: 300,
  564. editBtn: false,
  565. delBtn: false,
  566. menuWidth: 140,
  567. dialogTop: 25,
  568. dialogWidth: "80%",
  569. addRowBtn: false,
  570. cellBtn: true,
  571. rowKey: "index",
  572. cancelBtn: false,
  573. columnBtn: false,
  574. // saveBtn:false,
  575. column: [
  576. {
  577. label: "联系人",
  578. prop: "contacts",
  579. cell: true,
  580. rules: [
  581. {
  582. required: true,
  583. message: " ",
  584. trigger: "blur",
  585. },
  586. ],
  587. },
  588. {
  589. label: "电话",
  590. prop: "tel",
  591. cell: true,
  592. rules: [
  593. {
  594. required: true,
  595. message: " ",
  596. trigger: "blur",
  597. },
  598. ],
  599. },
  600. {
  601. label: "所属地区",
  602. prop: "belongtoarea",
  603. dicData: [],
  604. dataType: "string",
  605. type: "cascader",
  606. emitPath: false,
  607. props: {
  608. label: "name",
  609. value: "code",
  610. },
  611. rules: [
  612. {
  613. required: true,
  614. message: " ",
  615. trigger: "blur",
  616. },
  617. ],
  618. filterable: true,
  619. cell: true,
  620. },
  621. {
  622. label: "详细地址",
  623. prop: "detailedAddress",
  624. cell: true,
  625. rules: [
  626. {
  627. required: true,
  628. message: " ",
  629. trigger: "blur",
  630. },
  631. ],
  632. },
  633. {
  634. label: "备注",
  635. prop: "remarks",
  636. cell: true,
  637. },
  638. {
  639. label: "默认地址",
  640. prop: "defaultAddres",
  641. display: false,
  642. width: 100,
  643. },
  644. ],
  645. },
  646. option3: {},
  647. option4: {
  648. menuBtn: false,
  649. labelWidth: 80,
  650. column: [
  651. {
  652. label: "分类名称",
  653. prop: "cname",
  654. rules: [
  655. {
  656. required: true,
  657. message: "",
  658. trigger: "blur",
  659. },
  660. ],
  661. span: 24,
  662. },
  663. {
  664. label: "上级类型",
  665. prop: "parentId",
  666. dicData: [],
  667. type: "tree",
  668. props: {
  669. label: "cname",
  670. value: "id",
  671. },
  672. span: 24,
  673. },
  674. ],
  675. },
  676. corpsFiles: [],
  677. customerContactBack: {
  678. align: "center",
  679. index: true,
  680. // addBtnText: "录入明细",
  681. refreshBtn: false,
  682. dialogDrag: true,
  683. addBtn: false,
  684. span: 8,
  685. height: 300,
  686. addRowBtn: false,
  687. editBtn: false,
  688. delBtn: false,
  689. menuWidth: 200,
  690. dialogTop: 25,
  691. dialogWidth: "80%",
  692. columnBtn: false,
  693. column: [
  694. {
  695. label: "联系人",
  696. prop: "cname",
  697. cell: true,
  698. rules: [
  699. {
  700. required: true,
  701. message: " ",
  702. trigger: "blur",
  703. },
  704. ],
  705. },
  706. {
  707. label: "电话",
  708. prop: "tel",
  709. cell: true,
  710. rules: [
  711. {
  712. required: true,
  713. message: " ",
  714. trigger: "blur",
  715. },
  716. ],
  717. },
  718. // {
  719. // label: "登录用户id",
  720. // prop: "userId",
  721. // cell: true
  722. // },
  723. {
  724. label: "备注",
  725. prop: "remarks",
  726. cell: true,
  727. },
  728. ],
  729. },
  730. userObj: {},
  731. };
  732. },
  733. components: { corpType, dicSelect, corpLabel },
  734. props: {
  735. detailData: {
  736. type: Object,
  737. },
  738. },
  739. async created() {
  740. if (this.detailData.id) {
  741. this.getDetail(this.detailData.id);
  742. }
  743. if (this.detailData.status == 1) {
  744. this.option.disabled = true;
  745. }
  746. if (!website.tenantMode) {
  747. this.initData(website.tenantId);
  748. } else {
  749. this.initData();
  750. }
  751. this.getCorpType();
  752. this.getAllWorkDicts();
  753. this.userObj = JSON.parse(localStorage.getItem("saber-userInfo")).content;
  754. },
  755. activated() {
  756. setTimeout(() => {
  757. this.$nextTick(() => {
  758. this.$refs.crud.doLayout();
  759. });
  760. }, 100);
  761. },
  762. methods: {
  763. uploadAfter(res, done, loading, column) {
  764. let obj = {
  765. url: res.link,
  766. name: res.originalName,
  767. extname: this.getFileExtension(res.originalName),
  768. };
  769. this.form.businessLicense = JSON.stringify(obj);
  770. done();
  771. },
  772. getFileExtension(filename) {
  773. return filename.slice(((filename.lastIndexOf(".") - 1) >>> 0) + 2);
  774. },
  775. allClick(name) {
  776. if (name == "提交审批") {
  777. this.$refs.form.validate((valid, done) => {
  778. done();
  779. if (valid) {
  780. if (this.contactsData.length == 0) return this.$message.error("请添加客户联系人");
  781. if (this.data.length == 0) return this.$message.error("请添加地址信息");
  782. if (this.corpsFiles.length == 0) return this.$message.error("请添加门店照片");
  783. if (this.corpsFiles.filter((item) => item.mainImage == 1).length > 1)
  784. return this.$message.error("门店照片主图只允许选一个");
  785. if (this.corpsFiles.filter((item) => item.mainImage == 1).length == 0) {
  786. this.corpsFiles[0].mainImage = 1;
  787. }
  788. this.$confirm("是否提交审批?", "提示", {
  789. confirmButtonText: "确定",
  790. cancelButtonText: "取消",
  791. type: "warning",
  792. }).then(() => {
  793. let obj = {
  794. id: this.form.id,
  795. };
  796. submitApply(obj).then((res) => {
  797. this.$message.success("操作成功");
  798. this.getDetail(this.form.id);
  799. });
  800. });
  801. } else {
  802. return false;
  803. }
  804. });
  805. }
  806. if (name == "审批") {
  807. this.$confirm("是否通过审核?", "提示", {
  808. distinguishCancelAndClose: true,
  809. confirmButtonText: "通过",
  810. cancelButtonText: "驳回",
  811. type: "warning",
  812. })
  813. .then(() => {
  814. let obj = {
  815. id: this.form.id,
  816. type: 1,
  817. };
  818. review(obj).then((res) => {
  819. this.$message.success("操作成功");
  820. this.getDetail(this.form.id);
  821. });
  822. })
  823. .catch((action) => {
  824. if (action == "cancel") {
  825. let obj = {
  826. id: this.form.id,
  827. type: 2,
  828. };
  829. review(obj).then((res) => {
  830. this.$message.success("操作成功");
  831. this.getDetail(this.form.id);
  832. });
  833. }
  834. });
  835. }
  836. },
  837. dicChange(name, row) {
  838. if (name == "salesmanName") {
  839. if (row) {
  840. this.form.salesmanId = row.id;
  841. } else {
  842. this.form.salesmanId = null;
  843. this.form.salesmanName = null;
  844. }
  845. }
  846. if (name == "brandName") {
  847. if (row) {
  848. this.form.brandId = row.ids;
  849. this.form.brandName = row.names;
  850. } else {
  851. this.form.brandId = null;
  852. this.form.brandName = null;
  853. }
  854. }
  855. if (name == "deliveryWarehouseName") {
  856. if (row) {
  857. this.form.deliveryWarehouseId = row.id;
  858. } else {
  859. this.form.deliveryWarehouseId = null;
  860. this.form.deliveryWarehouseName = null;
  861. }
  862. }
  863. if (name == "label") {
  864. this.form.label = row.names;
  865. }
  866. },
  867. // 启用或禁用
  868. editEnable() {
  869. if (this.form.enableOrNot == 0) {
  870. if (this.form.checkStatus != "审核通过") {
  871. return this.$message.error("审核通过以后可以启用");
  872. }
  873. }
  874. let data = this.form;
  875. editenable({ id: data.id, enableOrNot: data.enableOrNot ? 0 : 1 }).then((res) => {
  876. this.$message({
  877. type: "success",
  878. message: data.enableOrNot ? "禁用成功!" : "启用成功!",
  879. });
  880. this.getDetail(this.detailData.id);
  881. // this.$set(this.form, 'enableOrNot', data.enableOrNot == 1 ? 0 : 1)
  882. });
  883. },
  884. addressUnique(row, index) {
  885. for (let item in this.data) {
  886. if (index != item) {
  887. if (this.data[item].defaultAddres == 1) {
  888. this.$message.warning("开启默认地址");
  889. return (row.defaultAddres = 0);
  890. }
  891. }
  892. }
  893. },
  894. initData(tenantId) {
  895. getRoleTree(tenantId).then((res) => {
  896. const column = this.findObject(this.optionData.column, "roleId");
  897. column.dicData = res.data.data;
  898. });
  899. getDeptTree(tenantId).then((res) => {
  900. const column = this.findObject(this.optionData.column, "deptId");
  901. column.dicData = res.data.data;
  902. });
  903. getPostList(tenantId).then((res) => {
  904. const column = this.findObject(this.optionData.column, "postId");
  905. column.dicData = res.data.data;
  906. });
  907. },
  908. //确认创建用户
  909. confirmSynchronizationTwo() {
  910. this.$refs.formDataTwo.validate((valid, done) => {
  911. done();
  912. if (valid) {
  913. let data = JSON.parse(JSON.stringify(this.formDataTwo));
  914. data.deptId = data.deptId.join(",");
  915. data.roleId = data.roleId.join(",");
  916. data.postId = data.postId.join(",");
  917. creatingUsersTwo({
  918. ...data,
  919. id: this.formRow.id,
  920. }).then((res) => {
  921. this.dialogVisibleBt = false;
  922. this.formDataTwo = {};
  923. this.$message.success("创建用户成功,默认帐号:手机号。默认密码:123456");
  924. this.getDetail(this.form.id);
  925. });
  926. } else {
  927. return false;
  928. }
  929. });
  930. },
  931. getAllWorkDicts() {
  932. customerList({ corpType: "KH" }).then((res) => {
  933. this.findObject(this.option4.column, "parentId").dicData = res.data.data.records;
  934. });
  935. this.findObject(this.option2.column, "belongtoarea").dicData = JSON.parse(localStorage.getItem("areaTypeTree"))
  936. ? JSON.parse(localStorage.getItem("areaTypeTree"))
  937. : [];
  938. },
  939. getDetail(id) {
  940. this.loadingBtn = true;
  941. getDetails({ id: id })
  942. .then((res) => {
  943. if (res.data.data.enableOrNot == 1) {
  944. this.$set(this.option, "disabled", true);
  945. } else {
  946. this.$set(this.option, "disabled", false);
  947. }
  948. this.data = res.data.data.corpsAddrList;
  949. this.corpsFiles = res.data.data.corpsFilesList;
  950. this.contactsData = res.data.data.corpsAttnList;
  951. this.form = res.data.data;
  952. })
  953. .finally(() => {
  954. this.loadingBtn = false;
  955. });
  956. },
  957. addRow() {
  958. this.data.push({ $cellEdit: true });
  959. },
  960. rowDel(row, index) {
  961. this.$confirm("确定删除数据?", {
  962. confirmButtonText: "确定",
  963. cancelButtonText: "取消",
  964. type: "warning",
  965. }).then(() => {
  966. if (row.id) {
  967. itemDel(row.id).then((res) => {
  968. this.$message({
  969. type: "success",
  970. message: "删除成功!",
  971. });
  972. this.data.splice(index, 1);
  973. });
  974. } else {
  975. this.$message({
  976. type: "success",
  977. message: "删除成功!",
  978. });
  979. this.data.splice(index, 1);
  980. }
  981. });
  982. },
  983. addRow2() {
  984. this.data2.push({ $cellEdit: true, type: 1 });
  985. },
  986. rowCell2(row, index) {
  987. if (row.$cellEdit == true) {
  988. this.$set(row, "$cellEdit", false);
  989. } else {
  990. this.$set(row, "$cellEdit", true);
  991. }
  992. },
  993. rowDe2(row, index) {
  994. this.$confirm("确定删除数据?", {
  995. confirmButtonText: "确定",
  996. cancelButtonText: "取消",
  997. type: "warning",
  998. }).then(() => {
  999. if (row.id) {
  1000. // itemDel(row.id).then(res => {
  1001. // this.$message({
  1002. // type: "success",
  1003. // message: "删除成功!"
  1004. // });
  1005. // this.data2.splice(index, 1);
  1006. // });
  1007. } else {
  1008. this.$message({
  1009. type: "success",
  1010. message: "删除成功!",
  1011. });
  1012. this.data2.splice(index, 1);
  1013. }
  1014. });
  1015. },
  1016. corpTypeClosed() {
  1017. // this.reload = Math.random();
  1018. // this.form4 = this.$options.data().form4
  1019. },
  1020. getCorpType() {
  1021. getCorpType({ corpType: "KH" }).then((res) => {
  1022. this.corpTypeList = res.data.data;
  1023. });
  1024. },
  1025. addCorpType() {
  1026. this.getCorpType();
  1027. this.corpTypeVisible = false;
  1028. },
  1029. addLabel() {
  1030. this.labelKey = Date.now();
  1031. this.labelVisible = false;
  1032. },
  1033. //修改提交触发
  1034. editCustomer() {
  1035. this.$refs.form.validate((valid, done) => {
  1036. done();
  1037. if (valid) {
  1038. if (this.contactsData.length == 0) return this.$message.error("请添加客户联系人");
  1039. if (this.data.length == 0) return this.$message.error("请添加地址信息");
  1040. if (this.corpsFiles.length == 0) return this.$message.error("请添加门店照片");
  1041. if (this.corpsFiles.filter((item) => item.mainImage == 1).length > 1)
  1042. return this.$message.error("附件主图只允许选一个");
  1043. if (this.corpsFiles.filter((item) => item.mainImage == 1).length == 0) {
  1044. this.corpsFiles[0].mainImage = 1;
  1045. }
  1046. this.loadingBtn = true;
  1047. submit({
  1048. ...this.form,
  1049. code: this.form.cname,
  1050. corpType: "KH",
  1051. corpsAddrList: this.data,
  1052. corpsFilesList: this.corpsFiles,
  1053. corpsAttnList: this.contactsData,
  1054. billType: 1,
  1055. })
  1056. .then((res) => {
  1057. this.$message.success("保存成功");
  1058. this.form = res.data.data;
  1059. this.data = res.data.data.corpsAddrList;
  1060. this.corpsFiles = res.data.data.corpsFilesList;
  1061. this.getDetail(res.data.data.id);
  1062. })
  1063. .finally(() => {
  1064. this.loadingBtn = false;
  1065. });
  1066. } else {
  1067. return false;
  1068. }
  1069. });
  1070. },
  1071. creatingUsers(row) {
  1072. console.log("row", row);
  1073. if (!row.id) {
  1074. return this.$message.error("请保存数据");
  1075. }
  1076. if (!row.cname || !row.tel) {
  1077. return this.$message.error("请完善联系人和电话");
  1078. }
  1079. if (!row.id) {
  1080. return this.$message.error("请保存数据");
  1081. }
  1082. if (row.userId) {
  1083. return this.$message.error("已创建,请勿重复操作");
  1084. }
  1085. this.$confirm("是否创建用户?", "提示", {
  1086. confirmButtonText: "确定",
  1087. cancelButtonText: "取消",
  1088. type: "warning",
  1089. }).then(() => {
  1090. creatingUsersTwo({
  1091. id: row.id,
  1092. }).then((res) => {
  1093. this.$message.success("创建用户成功,默认帐号:手机号。默认密码:123456");
  1094. this.getDetail(this.form.id);
  1095. });
  1096. });
  1097. },
  1098. //新增客户联系人保存触发
  1099. rowSave(row, done, loading) {
  1100. if (this.data.length == 1) {
  1101. this.$set(row, "defaultAddres", "1");
  1102. }
  1103. done(row);
  1104. },
  1105. //修改客户联系人触发
  1106. rowUpdate(row, index, done, loading) {
  1107. done(row);
  1108. },
  1109. //删除客户联系人触发
  1110. rowDelTwo(row, index, donerowDel) {
  1111. this.$confirm("确定将选择数据删除?", {
  1112. confirmButtonText: "确定",
  1113. cancelButtonText: "取消",
  1114. type: "warning",
  1115. }).then(() => {
  1116. // 数据回调进行刷新
  1117. if (row.id) {
  1118. corpsattn(row.id).then((res) => {
  1119. this.$message({
  1120. type: "success",
  1121. message: "操作成功!",
  1122. });
  1123. this.contactsData.splice(index, 1);
  1124. });
  1125. } else {
  1126. this.$message({
  1127. type: "success",
  1128. message: "操作成功!",
  1129. });
  1130. this.contactsData.splice(index, 1);
  1131. }
  1132. });
  1133. },
  1134. //返回列表
  1135. backToList() {
  1136. this.$emit("goBack");
  1137. },
  1138. },
  1139. };
  1140. </script>
  1141. <style lang="scss" scoped>
  1142. .trading-form ::v-deep .el-form-item {
  1143. margin-bottom: 8px !important;
  1144. }
  1145. ::v-deep .el-dialog__body {
  1146. padding: 0px 20px 15px 20px;
  1147. }
  1148. ::v-deep .el-form-item__error {
  1149. display: none !important;
  1150. }
  1151. .el-dialog ::v-deep .el-form-item__error {
  1152. display: none !important;
  1153. }
  1154. .img-form ::v-deep .el-form-item {
  1155. height: 150px;
  1156. line-height: 150px;
  1157. margin-bottom: 8px !important;
  1158. }
  1159. .img-form ::v-deep .avue-upload__icon {
  1160. font-size: 20px;
  1161. width: 150px;
  1162. height: 150px;
  1163. line-height: 150px;
  1164. }
  1165. ::v-deep .el-table .cell {
  1166. padding: 0 2px !important;
  1167. }
  1168. ::v-deep .avue-crud .el-table .el-form-item__label {
  1169. left: -1px;
  1170. }
  1171. .addressTabs {
  1172. display: flex;
  1173. justify-content: center;
  1174. span {
  1175. width: 100px;
  1176. font-size: 18px;
  1177. font-weight: 600;
  1178. text-align: center;
  1179. }
  1180. }
  1181. </style>