add.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691
  1. <template>
  2. <div v-loading="isLoading" class="addSupplier">
  3. <el-form ref="formData1Ref" :model="formData1" :rules="formDataRules" label-width="120px" class="addForm">
  4. <el-form-item label="供应商类型:" prop="shopType">
  5. <el-select
  6. v-model="formData1.shopType"
  7. placeholder="请选择供应商类型"
  8. style="width: 100%"
  9. @change="handleTypeChange"
  10. >
  11. <el-option label="品牌方" :value="1" />
  12. <el-option label="代理商" :value="2" />
  13. </el-select>
  14. </el-form-item>
  15. <!-- 供应商名称 -->
  16. <el-form-item v-if="formData1.shopType === 2" label="供应商名称:" prop="shopName">
  17. <el-input v-model="formData1.shopName" placeholder="请输入供应商名称" maxlength="50" show-word-limit />
  18. </el-form-item>
  19. <el-form-item v-if="formData1.shopType === 1" clearable label="供应商名称:" prop="brandId">
  20. <el-select
  21. v-model="formData1.brandId"
  22. placeholder="请选择品牌"
  23. style="width: 100%"
  24. filterable
  25. @change="handleBrandChange"
  26. >
  27. <el-option v-for="item in brandList" :key="item.id" :label="item.name" :value="item.id" />
  28. </el-select>
  29. </el-form-item>
  30. <!-- 供应商名称END -->
  31. <el-form-item label="手机号:" prop="mobile">
  32. <el-input v-model="formData1.mobile" placeholder="请输入手机号" maxlength="11" show-word-limit @input="handleInput" />
  33. </el-form-item>
  34. <el-form-item label="联系人:" prop="linkMan">
  35. <el-input v-model="formData1.linkMan" placeholder="请输入联系人" />
  36. </el-form-item>
  37. <transition name="fade">
  38. <el-form-item v-if="formData1.shopType === 2" label="代理品牌:" prop="shopInfo" class="brand-list">
  39. <template v-if="supplierBrands !== []">
  40. <el-tag v-for="(brand , index) in supplierBrands" :key="index" closable type="success" @close="handleRemove(index)" @click="handleShowInfo(index)">{{ brand.brandName }}</el-tag>
  41. </template>
  42. <el-tag type="primary" @click="handleShowDialog">添加品牌<span class="el-icon-plus" /></el-tag>
  43. <!-- <el-input v-model="formData1.shopInfo" class="hiddenInput" /> -->
  44. </el-form-item>
  45. </transition>
  46. <template v-if="formData1.shopType === 1">
  47. <el-form-item label="产地:" prop="countryId">
  48. <el-select v-model="formData1.countryId" placeholder="产地" style="width: 100%" filterable>
  49. <el-option
  50. v-for="item in countryList"
  51. :key="item.countryId"
  52. :label="item.countryName"
  53. :value="item.countryId"
  54. />
  55. </el-select>
  56. </el-form-item>
  57. <el-form-item label="品牌logo:" class="no-input" prop="brandAuthLogo">
  58. <upload-image
  59. ref="uploadImageRef1"
  60. :file-list="fileList1"
  61. @success="imageUploadSuccess1"
  62. @error="imageUploadFaild1"
  63. @remove="imageRemove1"
  64. />
  65. <el-input v-model="formData1.brandAuthLogo" type="hidden" class="hiddenInput" />
  66. </el-form-item>
  67. <el-form-item label="官网认证链接:">
  68. <el-input v-model="formData1.securityLink" placeholder="请输入官网认证链接" />
  69. </el-form-item>
  70. </template>
  71. <!-- 公众号信息 -->
  72. <el-form-item label="微信公众号:">
  73. <el-select v-model="formData1.appType" placeholder="请选择微信公众号类型" style="width: 100%">
  74. <el-option label="服务号" :value="1" />
  75. <el-option label="订阅号" :value="0" />
  76. </el-select>
  77. </el-form-item>
  78. <el-form-item label="appID:">
  79. <el-input v-model="formData1.appId" placeholder="微信公众号appID,没有就不填" />
  80. </el-form-item>
  81. <el-form-item label="appSecret:">
  82. <el-input v-model="formData1.appSecret" placeholder="微信公众号appsecret,没有就不填" />
  83. </el-form-item>
  84. <el-form-item label="公众号二维码:" prop="qrCodeImage">
  85. <upload-image
  86. ref="uploadImageRef1"
  87. :file-list="ewmUrl"
  88. tip-title="128px*128px"
  89. @success="wxImageUploadSuccess"
  90. @error="wxImageUploadFaild"
  91. @remove="wxImageUploadRemove"
  92. />
  93. <el-input v-model="formData1.qrCodeImage" type="hidden" class="hiddenInput" />
  94. </el-form-item>
  95. <!-- 公众号信息END -->
  96. <el-form-item label="供应商状态:">
  97. <el-select v-model="formData1.shopStatus" placeholder="请选择供应商状态" style="width: 100%">
  98. <el-option label="启用" :value="1" />
  99. <el-option label="禁用" :value="0" />
  100. </el-select>
  101. </el-form-item>
  102. </el-form>
  103. <div class="submit-btn">
  104. <el-button type="primary" @click="submit">保存</el-button>
  105. <el-button type="warning" @click="$_back()">返回</el-button>
  106. </div>
  107. <!-- 供应商添加品牌的对话框 -->
  108. <el-dialog :title="dialogTitleText" :visible.sync="showDialog" width="width" @closed="dialogClosed">
  109. <el-form ref="formData2Ref" :model="formData2" label-width="120px" :rules="formDataRules">
  110. <el-form-item label="选择品牌:" prop="brandId">
  111. <el-select
  112. v-model="formData2.brandId"
  113. placeholder="请选择品牌"
  114. style="width: 100%"
  115. filterable
  116. @change="handleBrandChange"
  117. >
  118. <el-option v-for="item in brandListCopy" :key="item.id" :label="item.name" :value="item.id" />
  119. </el-select>
  120. </el-form-item>
  121. <el-form-item label="产地:" prop="countryId">
  122. <el-select v-model="formData2.countryId" placeholder="产地" style="width: 100%" filterable>
  123. <el-option
  124. v-for="item in countryList"
  125. :key="item.countryId"
  126. :label="item.countryName"
  127. :value="item.countryId"
  128. />
  129. </el-select>
  130. </el-form-item>
  131. <el-form-item label="品牌logo:" class="no-input" prop="brandAuthLogo">
  132. <upload-image
  133. ref="uploadImageRef2"
  134. :file-list="fileList2"
  135. @success="imageUploadSuccess2"
  136. @error="imageUploadFaild2"
  137. @remove="imageRemove2"
  138. />
  139. <el-input v-model="formData2.brandAuthLogo" type="hidden" class="hiddenInput" />
  140. </el-form-item>
  141. <el-form-item label="代理声明:">
  142. <el-radio-group v-model="formData2.statementType" @change="handleStatementChange">
  143. <el-radio :label="1">弹窗</el-radio>
  144. <el-radio :label="2">链接</el-radio>
  145. <el-radio :label="3">图片</el-radio>
  146. <el-radio :label="4">文件</el-radio>
  147. </el-radio-group>
  148. </el-form-item>
  149. <el-form-item v-if="formData2.statementType === 1" ref="statement1" label="弹窗:" prop="statementContent">
  150. <el-input
  151. v-if="formData2.statementType === 1"
  152. v-model="formData2.statementContent"
  153. type="textarea"
  154. />
  155. </el-form-item>
  156. <el-form-item v-else-if="formData2.statementType === 2" ref="statement2" label="链接:" prop="statementLink">
  157. <el-input v-if="formData2.statementType === 2" v-model="formData2.statementLink" />
  158. </el-form-item>
  159. <el-form-item
  160. v-else-if="formData2.statementType === 3"
  161. ref="statement3"
  162. label="图片:"
  163. class="no-input"
  164. prop="statementImage"
  165. >
  166. <upload-image
  167. v-if="formData2.statementType === 3"
  168. ref="uploadImageRef3"
  169. :file-list="fileList3"
  170. tip-title="宽:760px"
  171. @success="imageUploadSuccess3"
  172. @error="imageUploadFaild3"
  173. @remove="imageRemove3"
  174. />
  175. <el-input v-model="formData2.statementImage" type="hidden" class="hiddenInput" />
  176. </el-form-item>
  177. <el-form-item v-else ref="statementFileRef" label="文件:" prop="statementFileId">
  178. <upload-file
  179. v-if="formData2.statementType === 4"
  180. ref="uploadFileRef"
  181. :auth-user-id="formData2.authUserId"
  182. :brand-id="formData2.brandId"
  183. :file-list="fileList4"
  184. @success="fileUploadSuccess"
  185. @error="fileUploadFaild"
  186. @remove="fileRemove"
  187. @change="fileChange"
  188. />
  189. <el-input v-model="formData2.statementFileId" type="hidden" class="hiddenInput" />
  190. </el-form-item>
  191. <el-form-item label="官网认证链接:">
  192. <el-input v-model="formData2.securityLink" placeholder="请输入官网认证链接" />
  193. </el-form-item>
  194. </el-form>
  195. <div slot="footer">
  196. <el-button @click="showDialog = false">取 消</el-button>
  197. <el-button type="primary" :loading="dialogLoading" @click="handleAddBrand">确 定</el-button>
  198. </div>
  199. </el-dialog>
  200. </div>
  201. </template>
  202. <script>
  203. import UploadImage from '../components/uploadImage'
  204. import UploadFile from '../components/uploadFile'
  205. import { mapGetters } from 'vuex'
  206. import { isMobile } from '@/utils/validate'
  207. import { fetchBrandList } from '@/api/brand'
  208. import { addSupplier } from '@/api/supplier'
  209. export default {
  210. components: { UploadImage, UploadFile },
  211. data() {
  212. const validMobile = (rule, value, callback) => {
  213. if (!isMobile(value)) {
  214. return callback(new Error('手机号格式不正确'))
  215. }
  216. return callback()
  217. }
  218. return {
  219. isCheckout: true,
  220. isLoading: false,
  221. dialogLoading: false,
  222. showDialog: false,
  223. excludeBrandList: [], // 已经选择的品牌,需要被排除在外的
  224. selectedShopType: 1,
  225. currentIndex: '',
  226. prevBrandId: '',
  227. dialogTitle: '添加',
  228. // 表单1
  229. formData1: {
  230. shopType: 1, // 供应商类型
  231. shopName: '', // 供应商名称
  232. brandId: '', // 品牌id
  233. mobile: '', // 手机号
  234. linkMan: '', // 联系人
  235. countryId: 1, // 产地id
  236. brandAuthLogo: '', // 品牌logo
  237. securityLink: '', // 官网认证链接
  238. shopStatus: 1, // 供应商状态,
  239. shopInfo: '',
  240. appType: '',
  241. appId: '',
  242. appSecret: '',
  243. qrCodeImage: '' // 微信公众号二维码
  244. },
  245. // 表单2
  246. formData2: {
  247. index: '',
  248. isNew: true,
  249. brandName: '',
  250. brandId: '', // 品牌id
  251. countryId: 1, // 产地id
  252. brandAuthLogo: '', // 品牌logo
  253. securityLink: '', // 官网认证链接
  254. statementType: 1, // 代理声明类型
  255. statementContent: '', // 声明内容
  256. statementFileId: null, // 声明文件id
  257. statementImage: '', // 声明图片
  258. statementLink: '', // 声明链接
  259. statementFileName: '' // 上传图片的名称
  260. },
  261. supplierBrands: [],
  262. brandList: [],
  263. // 表单数据校验
  264. formDataRules: {
  265. shopType: { required: true, message: '供应商类型不能为空', tigger: 'change', type: 'number' },
  266. shopName: { required: true, message: '供应名称不能为空', tigger: 'change' },
  267. mobile: [{ required: true, message: '手机号不能为空', tigger: 'change' }, { validator: validMobile, tigger: 'change' }],
  268. linkMan: { required: true, message: '联系人不能为空', tigger: 'blur' },
  269. countryId: { required: true, message: '产地不能为空', tigger: 'change', type: 'number' },
  270. brandAuthLogo: { required: true, message: '品牌logo不能为空', tigger: 'change' },
  271. shopInfo: { required: true, message: '代理品牌不能为空', tigger: 'change', type: 'string' },
  272. brandId: { required: true, message: '品牌不能为空', tigger: 'change', type: 'number' },
  273. statementContent: { required: true, message: '声明内容不能为空', tigger: 'change' }, // 声明内容
  274. statementFileId: { required: true, message: '声明文件不能为空', tigger: 'change', type: 'number' }, // 声明文件id
  275. statementImage: { required: true, message: '声明图片不能为空', tigger: 'change' }, // 声明图片
  276. statementLink: { required: true, message: '声明链接不能为空', tigger: 'change' } // 声明链接
  277. // ewmUrl: { required: true, message: '微信公众号二维码不能为空', tigger: 'change' }
  278. },
  279. // 上传的文件列表
  280. fileList1: [],
  281. fileList2: [],
  282. fileList3: [],
  283. fileList4: [], // 文件
  284. ewmUrl: []
  285. }
  286. },
  287. computed: {
  288. ...mapGetters(['countryList', 'authUserId']),
  289. brandListCopy() {
  290. return this.brandList.filter(item => {
  291. return !this.excludeBrandList.includes(item.id)
  292. })
  293. },
  294. dialogTitleText() {
  295. return `${this.dialogTitle}代理品牌`
  296. }
  297. },
  298. watch: {
  299. supplierBrands() {
  300. if (this.supplierBrands.length > 0) {
  301. this.formData1.shopInfo = '1'
  302. } else {
  303. this.formData1.shopInfo = ''
  304. }
  305. }
  306. },
  307. created() {
  308. this.getBrandList(1)
  309. },
  310. methods: {
  311. // 提交保存
  312. submit() {
  313. this.$refs.formData1Ref.validate(valid => {
  314. if (!valid) return
  315. this.isLoading = true
  316. addSupplier(this.setAddParams()).then(res => {
  317. if (res.code !== 0) {
  318. return
  319. }
  320. const h = this.$createElement
  321. this.$notify.success({
  322. title: '添加供应商',
  323. message: h('i', { style: 'color: #333' }, `已添加供应商:"${this.formData1.shopName}"`),
  324. duration: 3000
  325. })
  326. this.$store.dispatch('tagsView/delView', this.$route)
  327. this.$router.push('/supplier')
  328. }).finally(() => {
  329. this.isLoading = false
  330. })
  331. })
  332. },
  333. // 封装请求参数
  334. setAddParams() {
  335. // 品牌方的参数列表
  336. const result = {
  337. authUserId: '',
  338. createBy: '',
  339. linkMan: '',
  340. mobile: '',
  341. shopName: '',
  342. shopStatus: '',
  343. shopType: '',
  344. shopInfo: [],
  345. qrCodeImage: '',
  346. appId: '',
  347. appSecret: ''
  348. }
  349. // 品牌方
  350. if (this.selectedShopType === 1) {
  351. for (const key in result) {
  352. if (Object.hasOwnProperty.call(result, key)) {
  353. if (key !== 'shopInfo') {
  354. result[key] = this.formData1[key]
  355. }
  356. }
  357. }
  358. result.shopInfo.push({
  359. brandId: this.formData1.brandId,
  360. countryId: this.formData1.countryId,
  361. brandAuthLogo: this.formData1.brandAuthLogo,
  362. securityLink: this.formData1.securityLink,
  363. statementType: 1,
  364. statementContent: '',
  365. statementFileId: null,
  366. statementImage: '',
  367. statementLink: ''
  368. })
  369. }
  370. // 代理商
  371. if (this.selectedShopType === 2) {
  372. for (const key in result) {
  373. if (Object.hasOwnProperty.call(result, key)) {
  374. if (key !== 'shopInfo') {
  375. result[key] = this.formData1[key]
  376. }
  377. }
  378. }
  379. result.shopInfo = this.supplierBrands
  380. }
  381. result.createBy = this.authUserId
  382. console.log(result)
  383. return result
  384. },
  385. // 获取品牌列表
  386. getBrandList(type) {
  387. fetchBrandList({ type }).then(res => {
  388. if (res.code !== 0) {
  389. return
  390. }
  391. this.brandList = res.data
  392. })
  393. },
  394. // 品牌改变事件
  395. handleBrandChange(id) {
  396. const selectBrand = this.brandList.filter(item => item.id === id)[0]
  397. // 选择品牌方
  398. if (this.formData1.shopType === 1) {
  399. this.fileList1 = []
  400. this.formData1.shopName = selectBrand.name
  401. this.formData1.brandAuthLogo = selectBrand.authLogo
  402. this.formData1.brandId = selectBrand.id
  403. if (selectBrand.authLogo) {
  404. this.fileList1 = [{ name: selectBrand.name, url: selectBrand.authLogo }]
  405. }
  406. }
  407. // 如果选择代理应商
  408. if (this.formData1.shopType === 2) {
  409. this.formData2.brandAuthLogo = selectBrand.authLogo
  410. this.formData2.brandName = selectBrand.name
  411. this.formData2.brandId = selectBrand.id
  412. if (selectBrand.authLogo) {
  413. this.fileList2 = [{ name: selectBrand.name, url: selectBrand.authLogo }]
  414. }
  415. }
  416. },
  417. // 添加品牌对话框
  418. handleShowDialog() {
  419. this.dialogTitle = '新增'
  420. this.showDialog = true
  421. this.resetFormData2()
  422. },
  423. // 添加品牌
  424. handleAddBrand() {
  425. this.dialogLoading = true
  426. // 如果声明类型为4,并且文件id为空或null,则需要先上传文件再保存
  427. if (this.formData2.statementType === 4 && (this.formData2.statementFileId === '' || this.formData2.statementFileId === null)) {
  428. this.$refs.uploadFileRef.$refs.upload.submit()
  429. } else {
  430. this.saveShopInfo()
  431. }
  432. },
  433. saveShopInfo() {
  434. this.dialogLoading = false
  435. this.$refs.formData2Ref.validate(valid => {
  436. if (!valid) {
  437. return
  438. }
  439. // 如果是新增的
  440. const shopInfo = this.clone(this.formData2)
  441. if (shopInfo.isNew) {
  442. this.supplierBrands.push(shopInfo)
  443. } else {
  444. // 修改的
  445. this.supplierBrands.splice(this.currentIndex, 1, shopInfo)
  446. }
  447. this.addExcludeBrand(shopInfo.brandId)
  448. shopInfo.isNew = false
  449. this.prevBrandId = ''
  450. this.showDialog = false
  451. const h = this.$createElement
  452. this.$notify.success({
  453. title: `${this.dialogTitle}品牌`,
  454. message: h('i', { style: 'color: #333' }, `${this.dialogTitle}品牌:"${shopInfo.brandName}"`),
  455. duration: 2000
  456. })
  457. })
  458. },
  459. // 移除品牌
  460. handleRemove(index) {
  461. const pop = this.supplierBrands.splice(index, 1)[0]
  462. this.removeExcludeBrand(pop.brandId)
  463. const h = this.$createElement
  464. this.$notify.success({
  465. title: '移除品牌',
  466. message: h('i', { style: 'color: #333' }, `已移除品牌:"${pop.brandName}"`),
  467. duration: 2000
  468. })
  469. },
  470. // 修改品牌
  471. handleShowInfo(index) {
  472. this.dialogTitle = '修改'
  473. this.currentIndex = index
  474. this.formData2 = this.clone(this.supplierBrands[index])
  475. this.prevBrandId = this.supplierBrands[index].brandId // 保存当前的品牌id
  476. this.fileList2 = [{ name: '', url: this.formData2.brandAuthLogo }]
  477. this.fileList3 = [{ name: '', url: this.formData2.statementImage }]
  478. this.fileList4 = [{ name: this.formData2.statementFileName, url: '' }]
  479. this.removeExcludeBrand(this.supplierBrands[index].brandId)
  480. this.showDialog = true
  481. },
  482. // 添加品牌对话框关闭
  483. dialogClosed() {
  484. if (this.prevBrandId) {
  485. this.addExcludeBrand(this.prevBrandId)
  486. this.prevBrandId = ''
  487. }
  488. this.resetFormData2()
  489. },
  490. // 声明类型切换
  491. handleStatementChange() {},
  492. // 供应商类型改变事件
  493. handleTypeChange(shopType) {
  494. this.selectedShopType = shopType
  495. this.getBrandList(shopType)
  496. this.resetFormData1(shopType)
  497. },
  498. // 添加排除品牌
  499. addExcludeBrand(id) {
  500. this.excludeBrandList.push(id)
  501. },
  502. // 移除排除品牌
  503. removeExcludeBrand(id) {
  504. const index = this.excludeBrandList.indexOf(id)
  505. this.excludeBrandList.splice(index, 1)
  506. },
  507. // 输入框输入时
  508. handleInput() {
  509. this.formData1.mobile = this.formData1.mobile.replace(/[^\w\.\/]/ig, '')
  510. },
  511. // 文件上传成功
  512. fileUploadSuccess(data) {
  513. this.formData2.statementFileName = data.data.fileName
  514. this.formData2.statementFileId = data.data.fileId
  515. if (data.code === 0) {
  516. this.saveShopInfo()
  517. }
  518. },
  519. fileUploadFaild(err, file, fileList) {
  520. this.$message.error('文件上传失败')
  521. console.log(err)
  522. },
  523. fileRemove() {
  524. this.formData2.statementFileId = null
  525. console.log('删除文件')
  526. },
  527. fileChange() {
  528. console.log('文件改变')
  529. this.$refs.statementFileRef.clearValidate()
  530. },
  531. // 图片上传成功 品牌logo 1
  532. imageUploadSuccess1(data) {
  533. this.formData1.brandAuthLogo = data.data
  534. },
  535. imageUploadFaild1(err, file, fileList) {
  536. this.$message.error('图片上传失败')
  537. console.log(err)
  538. },
  539. imageRemove1() {
  540. this.formData1.brandAuthLogo = ''
  541. console.log('删除图片')
  542. },
  543. // 图片上传成功 品牌logo 2
  544. imageUploadSuccess2(data) {
  545. this.formData2.brandAuthLogo = data.data
  546. },
  547. imageUploadFaild2(err, file, fileList) {
  548. this.$message.error('图片上传失败')
  549. console.log(err)
  550. },
  551. imageRemove2() {
  552. this.formData2.brandAuthLogo = ''
  553. console.log('删除图片')
  554. },
  555. // 图片上传成功 声明图片 3
  556. imageUploadSuccess3(data) {
  557. this.formData2.statementImage = data.data
  558. },
  559. imageUploadFaild3(err, file, fileList) {
  560. this.$message.error('图片上传失败')
  561. console.log(err)
  562. },
  563. imageRemove3() {
  564. this.formData2.statementImage = ''
  565. console.log('删除图片')
  566. },
  567. // 微信二维码上传
  568. wxImageUploadSuccess(data) {
  569. this.formData1.qrCodeImage = data.data
  570. },
  571. wxImageUploadFaild(err) {
  572. this.$message.error('图片上传失败')
  573. console.log(err)
  574. },
  575. wxImageUploadRemove() {
  576. this.formData1.qrCodeImage = ''
  577. },
  578. // 重置表单1
  579. resetFormData1(shopType) {
  580. this.formData1 = {
  581. shopType: shopType, // 供应商类型
  582. shopName: '', // 供应商名称
  583. brandId: '', // 品牌id
  584. mobile: '', // 手机号
  585. linkMan: '', // 联系人
  586. countryId: '', // 产地id
  587. brandAuthLogo: '', // 品牌logo
  588. securityLink: '', // 官网认证链接
  589. shopStatus: 1, // 供应商状态,
  590. shopInfo: [],
  591. qrCodeImage: ''
  592. }
  593. this.fileList1 = []
  594. this.fileList2 = []
  595. this.fileList3 = []
  596. this.fileList4 = []
  597. this.ewmUrl = []
  598. this.$refs.formData1Ref.clearValidate()
  599. },
  600. // 重置表单2
  601. resetFormData2() {
  602. this.formData2 = {
  603. index: '',
  604. isNew: true,
  605. brandName: '',
  606. brandId: '', // 品牌id
  607. countryId: 1, // 产地id
  608. brandAuthLogo: '', // 品牌logo
  609. securityLink: '', // 官网认证链接
  610. statementType: 1, // 代理声明类型
  611. statementContent: '', // 声明内容
  612. statementFileId: null, // 声明文件id
  613. statementImage: '', // 声明图片
  614. statementLink: '', // 声明链接
  615. statementFileName: ''
  616. }
  617. this.fileList1 = []
  618. this.fileList2 = []
  619. this.fileList3 = []
  620. this.fileList4 = []
  621. setTimeout(() => {
  622. this.$refs.formData2Ref.clearValidate()
  623. }, 200)
  624. },
  625. // 克隆
  626. clone(data) {
  627. const result = {}
  628. for (const key in data) {
  629. if (Object.hasOwnProperty.call(data, key)) {
  630. result[key] = data[key]
  631. }
  632. }
  633. return result
  634. }
  635. }
  636. }
  637. </script>
  638. <style lang="scss" scoped>
  639. .addSupplier {
  640. margin-bottom: 80px;
  641. }
  642. .addForm {
  643. width: 500px;
  644. margin: 0 auto;
  645. margin-top: 80px;
  646. .brand-list{
  647. .el-tag{
  648. margin-right: 5px;
  649. cursor: pointer;
  650. }
  651. }
  652. }
  653. .submit-btn {
  654. text-align: center;
  655. .el-button {
  656. width: 140px;
  657. }
  658. }
  659. .hiddenInput {
  660. display: none;
  661. }
  662. </style>