addCompetitorNew.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755
  1. <template>
  2. <div>
  3. <fullscreen :fullscreen.sync="fullscreen" class="container structure-l" style="margin: 0;width: calc(75% - 15px);">
  4. <div class="container-box">
  5. <toolList @iconCli='iconCli' :tooltit='tooltit'></toolList>
  6. <div class="info-form">
  7. <el-form :model="infolist" ref="infolist" :rules="rules">
  8. <div class="info-line">
  9. <el-form-item prop="violationCate">
  10. <span><i>*</i>类别</span>
  11. <el-select :popper-append-to-body="false" v-model="infolist.violationCate" placeholder="请选择类别" @change="verifcheck(1)">
  12. <el-option v-for="item in options1" :key="item.orderNumber" :label="item.dataName"
  13. :value="item.dataCode">
  14. </el-option>
  15. </el-select>
  16. </el-form-item>
  17. <el-form-item prop="provinceCode">
  18. <span><i>*</i>地域</span>
  19. <el-select :popper-append-to-body="false" v-model="infolist.provinceCode" placeholder="请选择省份" @change="verifcheck(2)">
  20. <el-option v-for="item in options2" :key="item.orderNumber" :label="item.dataName"
  21. :value="item.dataCode">
  22. </el-option>
  23. </el-select>
  24. </el-form-item>
  25. </div>
  26. <div class="info-line">
  27. <el-form-item prop="operatorCode">
  28. <span><i>*</i>运营商</span>
  29. <el-select :popper-append-to-body="false" v-model="infolist.operatorCode" placeholder="请选择运营商" @change="verifcheck(3)">
  30. <el-option v-for="item in options3" :key="item.orderNumber" :label="item.dataName"
  31. :value="item.dataCode">
  32. </el-option>
  33. </el-select>
  34. </el-form-item>
  35. <el-form-item prop="packageGear">
  36. <span><i>*</i>套餐档位</span>
  37. <el-select v-model="infolist.packageGear" placeholder="请选择" @change="verifcheck(4)" >
  38. <el-option
  39. v-for="item in options6"
  40. :key="item.value"
  41. :label="item.label"
  42. :value="item.value">
  43. </el-option>
  44. </el-select>
  45. </el-form-item>
  46. </div>
  47. <div class="info-line">
  48. <el-form-item prop="tariffName">
  49. <span><i>*</i>套餐名称</span>
  50. <el-input v-model="infolist.tariffName" placeholder="请输入资费名称"></el-input>
  51. </el-form-item>
  52. <el-form-item prop="recordRegionCode" class="info-line tea-r">
  53. <span><i>*</i>地市</span>
  54. <el-select :popper-append-to-body="false" v-model="infolist.recordRegionCode" placeholder="请选择违规地市" @change="verifcheck(5)">
  55. <el-option v-for="item in options5" :key="item.dataCode" :label="item.dataName"
  56. :value="item.dataCode">
  57. </el-option>
  58. </el-select>
  59. </el-form-item>
  60. </div>
  61. <div class="info-line">
  62. <el-form-item prop="monthFee">
  63. <span><i>*</i>月费(元)</span>
  64. <el-input v-model="infolist.monthFee" placeholder="请输入月费金额"></el-input>
  65. </el-form-item>
  66. <el-form-item prop="preFee">
  67. <span><i>*</i>预存款(元)</span>
  68. <el-input v-model="infolist.preFee" placeholder="请输入预存款金额"></el-input>
  69. </el-form-item>
  70. <el-form-item prop="concessionalRate">
  71. <span><i>*</i>优惠价(元)</span>
  72. <el-input v-model="infolist.concessionalRate" placeholder="请输入预存款金额"></el-input>
  73. </el-form-item>
  74. </div>
  75. <div class="info-line">
  76. <el-form-item>
  77. <span><i></i>酬金</span>
  78. <el-input v-model="infolist.remFee" placeholder="请输入酬金金额"></el-input>
  79. </el-form-item>
  80. <el-form-item prop="saleChnl">
  81. <span><i>*</i>销售渠道</span>
  82. <el-select :popper-append-to-body="false" v-model="infolist.saleChnl" placeholder="请选择销售渠道">
  83. <el-option v-for="item in saleChnlopt" :key="item.dataName" :label="item.dataName"
  84. :value="item.dataName">
  85. </el-option>
  86. </el-select>
  87. </el-form-item>
  88. </div>
  89. <div class="info-line">
  90. <el-form-item>
  91. <span><i></i>销售范围</span>
  92. <el-input v-model="infolist.saleScope" placeholder="请输入销售范围"></el-input>
  93. </el-form-item>
  94. <el-form-item>
  95. <span><i></i>月销量</span>
  96. <el-input v-model="infolist.monthSale" placeholder="请输入月销量"></el-input>
  97. </el-form-item>
  98. <el-form-item prop="isDb">
  99. <span><i>*</i>是否包含宽带</span>
  100. <el-select v-model="infolist.isDb" placeholder="请选择" >
  101. <el-option
  102. v-for="item in options7"
  103. :key="item.value"
  104. :label="item.label"
  105. :value="item.value">
  106. </el-option>
  107. </el-select>
  108. </el-form-item>
  109. <el-form-item>
  110. <span><i></i>宽带内容</span>
  111. <el-input v-model="infolist.dbContent" placeholder="请输入宽带内容"></el-input>
  112. </el-form-item>
  113. </div>
  114. <el-form-item prop="taffiffContent" class="info-line online">
  115. <span><i>*</i>套餐内容</span>
  116. <el-input v-model="infolist.taffiffContent" placeholder="请输入资费内容" type="textarea" :rows="3"></el-input>
  117. </el-form-item>
  118. <div style="padding-left: 60px">
  119. <myUpload @uploadBack="uploadBack" :fileInfo="fileInfo" :fileList="fileInfo.fileList"></myUpload>
  120. </div>
  121. </el-form>
  122. </div>
  123. <div class="titbtn-box">
  124. <el-button type="primary" plain @click="submitList(1)">取消</el-button>
  125. <el-button type="primary" @click="submitList">提交</el-button>
  126. </div>
  127. </div>
  128. </fullscreen>
  129. <competeRight></competeRight>
  130. </div>
  131. </template>
  132. <script>
  133. import competeRight from "../../../components/competeRight";
  134. import myUpload from "../../../components/upload";
  135. import toolList from "../../../components/toolList";
  136. export default {
  137. components: {
  138. competeRight,
  139. myUpload,
  140. toolList
  141. },
  142. data() {
  143. const fileLists = (rule, value, callback) => {
  144. if (!this.fileLists.length > 0) {
  145. callback(new Error('不能为空'))
  146. } else {
  147. callback()
  148. }
  149. }
  150. const opName = (rule, value, callback) => {
  151. if (!this.infolist.opName) {
  152. callback(new Error('不能为空'))
  153. } else {
  154. callback()
  155. }
  156. }
  157. const contactPhone = (rule, value, callback) => {
  158. let x = this.infolist.contactPhone * 1;
  159. if (!(/^1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$/.test(x))) {
  160. callback(new Error('请输入正确的电话号码'))
  161. } else {
  162. callback()
  163. }
  164. }
  165. const violationCate = (rule, value, callback) => {
  166. if (!this.infolist.violationCate) {
  167. callback(new Error('不能为空'))
  168. } else {
  169. callback()
  170. }
  171. }
  172. const provinceCode = (rule, value, callback) => {
  173. if (!this.infolist.provinceCode) {
  174. callback(new Error('不能为空'))
  175. } else {
  176. callback()
  177. }
  178. }
  179. const operatorCode = (rule, value, callback) => {
  180. if (!this.infolist.operatorCode) {
  181. callback(new Error('不能为空'))
  182. } else {
  183. callback()
  184. }
  185. }
  186. const recordRegionCode = (rule, value, callback) => {
  187. if (!this.infolist.recordRegionCode) {
  188. callback(new Error('不能为空'))
  189. } else {
  190. callback()
  191. }
  192. }
  193. const packageGear = (rule, value, callback) => {
  194. if (!this.infolist.packageGear) {
  195. callback(new Error('不能为空'))
  196. } else {
  197. callback()
  198. }
  199. }
  200. const tariffName = (rule, value, callback) => {
  201. if (!this.infolist.tariffName) {
  202. callback(new Error('不能为空'))
  203. } else {
  204. callback()
  205. }
  206. }
  207. const monthFee = (rule, value, callback) => {
  208. let x = isNaN(this.infolist.monthFee);
  209. if (x) {
  210. callback(new Error('请输入数字'))
  211. } else {
  212. callback()
  213. }
  214. }
  215. const preFee = (rule, value, callback) => {
  216. let x = isNaN(this.infolist.preFee);
  217. if (x) {
  218. callback(new Error('请输入数字'))
  219. } else {
  220. callback()
  221. }
  222. }
  223. const concessionalRate = (rule, value, callback) => {
  224. let x = isNaN(this.infolist.concessionalRate);
  225. if (x) {
  226. callback(new Error('请输入数字'))
  227. } else {
  228. callback()
  229. }
  230. }
  231. const remFee = (rule, value, callback) => {
  232. if (!this.infolist.remFee) {
  233. callback(new Error('不能为空'))
  234. } else {
  235. callback()
  236. }
  237. }
  238. const saleChnl = (rule, value, callback) => {
  239. if (!this.infolist.saleChnl) {
  240. callback(new Error('不能为空'))
  241. } else {
  242. callback()
  243. }
  244. }
  245. const saleScope = (rule, value, callback) => {
  246. if (!this.infolist.saleScope) {
  247. callback(new Error('不能为空'))
  248. } else {
  249. callback()
  250. }
  251. }
  252. const monthSale = (rule, value, callback) => {
  253. if (!this.infolist.monthSale) {
  254. callback(new Error('不能为空'))
  255. } else {
  256. callback()
  257. }
  258. }
  259. const isDb = (rule, value, callback) => {
  260. if (!this.infolist.isDb) {
  261. callback(new Error('不能为空'))
  262. } else {
  263. callback()
  264. }
  265. }
  266. const dbContent = (rule, value, callback) => {
  267. if (!this.infolist.dbContent) {
  268. callback(new Error('不能为空'))
  269. } else {
  270. callback()
  271. }
  272. }
  273. const evidenceType = (rule, value, callback) => {
  274. if (!this.infolist.evidenceType) {
  275. callback(new Error('不能为空'))
  276. } else {
  277. callback()
  278. }
  279. }
  280. const validateUsername = (rule, value, callback) => {
  281. if (!this.infolist.violationContent) {
  282. callback(new Error('不能为空'))
  283. } else {
  284. callback()
  285. }
  286. }
  287. const taffiffContent = (rule, value, callback) => {
  288. if (!this.infolist.taffiffContent) {
  289. callback(new Error('不能为空'))
  290. } else {
  291. callback()
  292. }
  293. }
  294. return {
  295. rules: {
  296. fileLists: [{
  297. required: true,
  298. trigger: 'change',
  299. validator: fileLists
  300. }],
  301. recordRegionCode: [{
  302. required: true,
  303. trigger: 'change',
  304. validator: recordRegionCode
  305. }],
  306. opName: [{
  307. required: true,
  308. trigger: 'blur',
  309. validator: opName
  310. }],
  311. contactPhone: [{
  312. required: true,
  313. trigger: 'blur',
  314. validator: contactPhone
  315. }],
  316. violationCate: [{
  317. required: true,
  318. trigger: 'change',
  319. validator: violationCate
  320. }],
  321. provinceCode: [{
  322. required: true,
  323. trigger: 'change',
  324. validator: provinceCode
  325. }],
  326. operatorCode: [{
  327. required: true,
  328. trigger: 'change',
  329. validator: operatorCode
  330. }],
  331. packageGear: [{
  332. required: true,
  333. trigger: 'change',
  334. validator: packageGear
  335. }],
  336. tariffName: [{
  337. required: true,
  338. trigger: 'blur',
  339. validator: tariffName
  340. }],
  341. monthFee: [{
  342. required: true,
  343. trigger: 'blur',
  344. validator: monthFee
  345. }],
  346. preFee: [{
  347. required: true,
  348. trigger: 'blur',
  349. validator: preFee
  350. }],
  351. concessionalRate: [{
  352. required: true,
  353. trigger: 'blur',
  354. validator: concessionalRate
  355. }],
  356. remFee: [{
  357. required: true,
  358. trigger: 'blur',
  359. validator: remFee
  360. }],
  361. saleChnl: [{
  362. required: true,
  363. trigger: 'change',
  364. validator: saleChnl
  365. }],
  366. monthSale: [{
  367. required: true,
  368. trigger: 'blur',
  369. validator: monthSale
  370. }],
  371. isDb: [{
  372. required: true,
  373. trigger: 'blur',
  374. validator: isDb
  375. }],
  376. dbContent: [{
  377. required: true,
  378. trigger: 'blur',
  379. validator: dbContent
  380. }],
  381. evidenceType: [{
  382. required: true,
  383. trigger: 'blur',
  384. validator: evidenceType
  385. }],
  386. saleScope: [{
  387. required: true,
  388. trigger: 'blur',
  389. validator: saleScope
  390. }],
  391. violationContent: [{
  392. required: true,
  393. trigger: 'blur',
  394. validator: validateUsername
  395. }],
  396. taffiffContent: [{
  397. required: true,
  398. trigger: 'blur',
  399. validator: taffiffContent
  400. }],
  401. },
  402. tooltit: '新增竞争对手信息',
  403. infolist: {},
  404. options1: [],
  405. options2: [],
  406. options3: [],
  407. options4: [],
  408. options5: [],
  409. options6: [{
  410. value: '低档:58元以下套餐',
  411. label: '低档:58元以下套餐'
  412. }, {
  413. value: '中档:58元(含)-128元套餐(不含)',
  414. label: '中档:58元(含)-128元套餐(不含)'
  415. }, {
  416. value: '高档:128元及以上套餐',
  417. label: '高档:128元及以上套餐'
  418. }],
  419. options7: [{
  420. value: '是',
  421. label: '是'
  422. }, {
  423. value: '否',
  424. label: '否'
  425. }],
  426. saleChnlopt: [],
  427. fullscreen: false,
  428. fileList: [],
  429. fileLists: [],
  430. attList: [],
  431. fileInfo: {
  432. limit: 5,
  433. url: '/market/compatt/upload',
  434. fileList: []
  435. },
  436. userInfo: {},
  437. }
  438. },
  439. methods: {
  440. //功能栏
  441. iconCli(v) {
  442. if (v === 1) {
  443. }
  444. if (v === 2) {
  445. this.fullscreen = !this.fullscreen
  446. }
  447. },
  448. //查询字典
  449. getListwglb() {
  450. this.$http({
  451. url: "/market/cfgDataDict/queryList",
  452. method: "post",
  453. headers: {
  454. "Content-Type": "application/json",
  455. },
  456. data: {
  457. dictCode: 'wglb'
  458. },
  459. }).then((res) => {
  460. this.options1 = res.data;
  461. });
  462. },
  463. getListsf() {
  464. this.$http({
  465. url: "/market/cfgDataDict/queryList",
  466. method: "post",
  467. headers: {
  468. "Content-Type": "application/json",
  469. },
  470. data: {
  471. dictCode: 'sf'
  472. },
  473. }).then((res) => {
  474. this.options2 = res.data;
  475. });
  476. },
  477. getListyys(v) {
  478. this.$http({
  479. url: "/market/cfgDataDict/queryList",
  480. method: "post",
  481. headers: {
  482. "Content-Type": "application/json",
  483. },
  484. data: {
  485. dictCode: 'yys'
  486. },
  487. }).then((res) => {
  488. if (v === 1) {
  489. this.options3 = [];
  490. res.data.forEach(item => {
  491. if (item.dataName !== '移动') {
  492. this.options3.push(item)
  493. }
  494. })
  495. } else {
  496. this.options3 = res.data;
  497. }
  498. });
  499. },
  500. getListwgxx() {
  501. this.$http({
  502. url: "/market/cfgDataDict/queryList",
  503. method: "post",
  504. headers: {
  505. "Content-Type": "application/json",
  506. },
  507. data: {
  508. dictCode: 'wgxx'
  509. },
  510. }).then((res) => {
  511. this.options4 = res.data;
  512. });
  513. },
  514. getListregion() {
  515. this.$http({
  516. url: "/market/cfgDataDict/queryList",
  517. method: "post",
  518. headers: {
  519. "Content-Type": "application/json",
  520. },
  521. data: {
  522. dictCode: 'region'
  523. },
  524. }).then((res) => {
  525. this.options5 = res.data;
  526. });
  527. },
  528. getsaleChnl() {
  529. this.$http({
  530. url: "/market/cfgDataDict/queryList",
  531. method: "post",
  532. headers: {
  533. "Content-Type": "application/json",
  534. },
  535. data: {
  536. dictCode: 'saleChnl'
  537. },
  538. }).then((res) => {
  539. this.saleChnlopt = res.data;
  540. });
  541. },
  542. //添加、取消
  543. submitList(v) {
  544. if (v === 1) {
  545. this.getUser();
  546. this.$router.push("/competitor?type=1");
  547. return
  548. }
  549. let _this = this;
  550. let attList = [];
  551. for (let i = 0; i < this.attList.length; i++) {
  552. attList.push({
  553. id: this.attList[i].id
  554. });
  555. }
  556. this.$refs.infolist.validate(valid => {
  557. if (valid) {
  558. let nowdata = _this.$formatDate(new Date(), "YYYY-MM-DD");
  559. this.infolist.opTime = nowdata;
  560. this.infolist.sts = 0;
  561. this.infolist.stsDesc = '未审核';
  562. this.infolist.type = '正规';
  563. this.$http({
  564. url: "/market/cwcompetitor/save",
  565. method: "post",
  566. headers: {
  567. "Content-Type": "application/json",
  568. },
  569. data: {
  570. wCompetitor: this.infolist,
  571. attList: attList
  572. },
  573. }).then((res) => {
  574. if (res.data.result === 1) {
  575. _this.$message({
  576. message: res.data.desc,
  577. type: 'error'
  578. });
  579. } else {
  580. _this.$message({
  581. message: '添加成功',
  582. type: 'success'
  583. });
  584. _this.$router.push("/competitor");
  585. }
  586. });
  587. }
  588. })
  589. },
  590. //处理所需数据
  591. verifcheck(v) {
  592. if (v === 1) {
  593. for (let i = 0; i < this.options1.length; i++) {
  594. if (this.options1[i].dataCode === this.infolist.violationCate) {
  595. this.infolist.violationCateName = this.options1[i].dataName
  596. }
  597. }
  598. }
  599. if (v === 2) {
  600. if (this.infolist.provinceCode === 'hlj') {
  601. this.getListyys(1);
  602. if (this.infolist.operatorCode === 'mobile') {
  603. this.infolist.operatorCode = '';
  604. }
  605. } else {
  606. this.getListyys();
  607. }
  608. for (let i = 0; i < this.options2.length; i++) {
  609. if (this.options2[i].dataCode === this.infolist.provinceCode) {
  610. this.infolist.provinceName = this.options2[i].dataName
  611. }
  612. }
  613. }
  614. if (v === 3) {
  615. for (let i = 0; i < this.options3.length; i++) {
  616. if (this.options3[i].dataCode === this.infolist.operatorCode) {
  617. this.infolist.operatorName = this.options3[i].dataName
  618. }
  619. }
  620. }
  621. if (v === 4) {
  622. for (let i = 0; i < this.options4.length; i++) {
  623. if (this.options4[i].dataCode === this.infolist.violationItem) {
  624. this.infolist.violationItemName = this.options4[i].dataName
  625. }
  626. }
  627. }
  628. if (v === 5) {
  629. for (let i = 0; i < this.options5.length; i++) {
  630. if (this.options5[i].dataCode === this.infolist.recordRegionCode) {
  631. this.infolist.recordRegionName = this.options5[i].dataName
  632. }
  633. }
  634. }
  635. },
  636. uploadBack(v) {
  637. this.attList = v;
  638. },
  639. getUser() {
  640. this.userInfo = JSON.parse(window.sessionStorage.userInfo);
  641. this.infolist = {
  642. opNo: '',
  643. regionName: '',
  644. regionCode: '',
  645. deptName: '',
  646. deptCode: '',
  647. opName: '',
  648. contactPhone: '',
  649. };
  650. this.infolist.opNo = this.userInfo.loginNo;
  651. // this.infolist.regionName = '';
  652. // this.infolist.regionCode = '';
  653. // this.infolist.deptName = '';
  654. // this.infolist.deptCode = '';
  655. this.infolist.opName = this.userInfo.loginName;
  656. this.infolist.contactPhone = this.userInfo.phoneNo;
  657. }
  658. },
  659. mounted() {
  660. },
  661. created() {
  662. this.getListwglb();
  663. this.getListyys();
  664. this.getListsf();
  665. this.getListwgxx();
  666. this.getListregion();
  667. this.getsaleChnl();
  668. this.getUser();
  669. },
  670. watch:{
  671. $route(to, from) {
  672. if(to.path === '/addCompetitor'){
  673. }
  674. },
  675. }
  676. }
  677. </script>
  678. <style scoped lang="scss">
  679. .titbox {
  680. div {
  681. float: right;
  682. margin-top: 20px;
  683. i {
  684. font-size: 22px;
  685. margin-left: 20px;
  686. cursor: pointer;
  687. }
  688. }
  689. }
  690. .info-form {
  691. margin-top: 30px;
  692. height: calc(100% - 150px);
  693. overflow-y: scroll;
  694. .info-line {
  695. width: 100%;
  696. display: block;
  697. div {
  698. width: 50%;
  699. display: inline-block;
  700. }
  701. span {
  702. width: 80px;
  703. display: inline-block;
  704. text-align: left;
  705. i {
  706. color: red;
  707. display: inline-block;
  708. padding-right: 5px;
  709. }
  710. }
  711. .el-select,
  712. .el-input {
  713. width: calc(100% - 100px);
  714. }
  715. }
  716. .tea-r {
  717. /*text-align: right;*/
  718. }
  719. .online {
  720. width: 100%;
  721. span {
  722. vertical-align: top;
  723. }
  724. .el-textarea {
  725. width: calc(100% - 100px);
  726. }
  727. }
  728. }
  729. .titbtn-box {
  730. text-align: right;
  731. margin: 15px 20px 0 0;
  732. button {
  733. width: 120px;
  734. }
  735. }
  736. </style>