EditModal.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685
  1. <template>
  2. <div>
  3. <el-dialog :visible.sync="visible" v-bind="modalOptions">
  4. <div>
  5. <el-form
  6. ref="formData"
  7. :model="formData"
  8. :rules="formRules"
  9. size="mini"
  10. label-suffix=":"
  11. label-width="160px"
  12. >
  13. <div>
  14. <el-tabs v-model="activeName">
  15. <el-tab-pane label="授权信息" name="first">
  16. <el-form-item label="店铺名称" prop="shopName">
  17. <el-input v-model="formData.shopName" maxlength="20" />
  18. </el-form-item>
  19. <el-form-item label="支持的支付类型" prop="payType">
  20. <el-radio-group v-model="formData.payType">
  21. <el-radio :label="9">惠市宝</el-radio>
  22. <el-radio :label="4">通联</el-radio>
  23. <el-radio :label="0">无</el-radio>
  24. </el-radio-group>
  25. </el-form-item>
  26. <el-form-item label="是否支持代金券" prop="isVoucher">
  27. <el-radio-group v-model="formData.isVoucher">
  28. <el-radio :label="1"> 允许 </el-radio>
  29. <el-radio :label="2"> 拒绝 </el-radio>
  30. </el-radio-group>
  31. </el-form-item>
  32. <el-form-item
  33. v-if="formData.isVoucher === 1"
  34. :rules="[
  35. {
  36. required: true,
  37. message: '请输入代金券返还比例',
  38. trigger: 'blur',
  39. },
  40. {
  41. type: 'number',
  42. max: 100,
  43. min: 0,
  44. message: '请输入正确的代金券返还比例,0 ~ 100',
  45. trigger: ['blur', 'change'],
  46. },
  47. ]"
  48. label="代金券返还比例"
  49. prop="voucherReturn"
  50. >
  51. <el-input
  52. v-model.number="formData.voucherReturn"
  53. style="width: 200px"
  54. placeholder="请填写代金券返还比例,范围0 ~ 100"
  55. >
  56. <template #append>%</template>
  57. </el-input>
  58. </el-form-item>
  59. <el-form-item label="代金券提现比例" prop="voucherCoinRatio">
  60. <el-input-number
  61. v-model="formData.voucherCoinRatio"
  62. :precision="2"
  63. :step="0.01"
  64. :max="1"
  65. ></el-input-number>
  66. <span style="margin-left: 10px">比例*100</span>
  67. </el-form-item>
  68. <el-form-item label="是否支持消费金" prop="isBeeCoin">
  69. <el-radio-group v-model="formData.isBeeCoin">
  70. <el-radio :label="1">支持</el-radio>
  71. <el-radio :label="2">不支持</el-radio>
  72. </el-radio-group>
  73. </el-form-item>
  74. <el-form-item
  75. v-if="formData.isBeeCoin === 1"
  76. label="商家消费金提现比例"
  77. prop="beeCoinRatio"
  78. >
  79. <el-input-number
  80. v-model="formData.beeCoinRatio"
  81. :precision="2"
  82. :step="0.01"
  83. :max="1"
  84. ></el-input-number>
  85. <span style="margin-left: 10px">比例*100</span>
  86. </el-form-item>
  87. <el-form-item label="店铺负责人" prop="chargePersonName">
  88. <el-input
  89. v-model="formData.chargePersonName"
  90. maxlength="20"
  91. />
  92. </el-form-item>
  93. <el-form-item label="负责人电话" prop="chargePersonPhone">
  94. <!-- .replace(/(\d{3})\d+(\d{4})$/, '$1****$2') -->
  95. <el-input
  96. v-model="formData.chargePersonPhone"
  97. maxlength="11"
  98. clearable
  99. />
  100. </el-form-item>
  101. <el-form-item label="请选择区域" prop="areaId">
  102. <el-cascader
  103. v-model="regionArrDialog"
  104. :props="regionProps"
  105. size="large"
  106. placeholder="请选择区域"
  107. @change="
  108. formData.areaId =
  109. regionArrDialog[regionArrDialog.length - 1]
  110. "
  111. ></el-cascader>
  112. <div v-if="formData.areaId">
  113. 已选ID:{{ formData.areaId }}
  114. </div>
  115. </el-form-item>
  116. <el-form-item label="官方分类" prop="classifyId">
  117. <!-- <el-cascader
  118. v-model="formData.classificationArr" placeholder="请选择官方分类" :options="categoryList"
  119. :props="{ checkStrictly: false, expandTrigger: 'hover', label: 'storeName', value: 'id', children: 'childs' }"
  120. clearable
  121. /> -->
  122. <el-cascader
  123. v-model="formData.classificationId"
  124. :options="categoryList"
  125. :props="{
  126. checkStrictly: false,
  127. expandTrigger: 'hover',
  128. label: 'storeName',
  129. value: 'id',
  130. children: 'childs',
  131. }"
  132. @change="handleSelectChange"
  133. ></el-cascader>
  134. </el-form-item>
  135. <el-form-item label="店铺地址" prop="shopAdress">
  136. <el-input v-model="formData.shopAdress" maxlength="60" />
  137. </el-form-item>
  138. <el-form-item label="店铺经纬度" prop="longitude">
  139. <div>
  140. <span v-if="formData.longitude">
  141. {{ formData.longitude }} - {{ formData.latitude }}
  142. </span>
  143. <el-button
  144. size="mini"
  145. type="primary"
  146. style="margin-left: 20px"
  147. @click="
  148. $refs.selectAddressMapRef &&
  149. $refs.selectAddressMapRef.show()
  150. "
  151. >
  152. {{ formData.longitude ? "修改" : "选择" }}
  153. </el-button>
  154. </div>
  155. </el-form-item>
  156. <el-form-item label="生效日期" prop="effectiveDate">
  157. <el-date-picker
  158. v-model="formData.effectiveDate"
  159. value-format="yyyy-MM-dd"
  160. type="date"
  161. placeholder="选择日期"
  162. />
  163. </el-form-item>
  164. <el-form-item label="生效年限" prop="effectiveYear">
  165. <el-input
  166. v-model="formData.effectiveYear"
  167. type="text"
  168. placeholder="请输入内容"
  169. maxlength="4"
  170. class="elipt"
  171. style="width: 50%"
  172. show-word-limit
  173. />
  174. <span class="elspan">年</span>
  175. </el-form-item>
  176. <el-form-item label="合同状态" prop="contractState">
  177. <el-radio-group v-model="formData.contractState">
  178. <el-radio :label="1"> 有效 </el-radio>
  179. <el-radio :label="0"> 无效 </el-radio>
  180. </el-radio-group>
  181. </el-form-item>
  182. <el-form-item label="店铺类型" prop="shopType">
  183. <el-radio-group v-model="formData.shopType">
  184. <!-- <el-radio :label="1">品牌厂家</el-radio> -->
  185. <el-radio :label="2">本地</el-radio>
  186. </el-radio-group>
  187. </el-form-item>
  188. <el-form-item
  189. v-if="formData.shopType === 2"
  190. prop="startTime"
  191. label="营业开始时间"
  192. :rules="[
  193. {
  194. required: true,
  195. message: '请选择营业开始时间',
  196. trigger: 'blur',
  197. },
  198. ]"
  199. >
  200. <el-time-select
  201. v-model="formData.startTime"
  202. placeholder="起始时间"
  203. :picker-options="{ start: '00:00', step: '00:05' }"
  204. >
  205. </el-time-select>
  206. </el-form-item>
  207. <el-form-item
  208. v-if="formData.shopType === 2"
  209. prop="endTime"
  210. label="营业结束时间"
  211. :rules="[
  212. {
  213. required: true,
  214. message: '请选择营业结束时间',
  215. trigger: 'blur',
  216. },
  217. ]"
  218. >
  219. <el-time-select
  220. v-model="formData.endTime"
  221. placeholder="营业结束时间"
  222. :picker-options="{
  223. start: '00:00',
  224. step: '00:05',
  225. end: '24:00',
  226. }"
  227. >
  228. </el-time-select>
  229. </el-form-item>
  230. <el-form-item label="惠市宝商家编号">
  231. <el-input v-model="formData.hsbMrchId" maxlength="60" />
  232. </el-form-item>
  233. <el-form-item label="直播间审核" prop="auditLive">
  234. <el-radio-group v-model="formData.auditLive">
  235. <el-radio :label="1">开启</el-radio>
  236. <el-radio :label="0">关闭</el-radio>
  237. </el-radio-group>
  238. </el-form-item>
  239. <el-form-item label="直播间商品审核" prop="auditLiveProduct">
  240. <el-radio-group v-model="formData.auditLiveProduct">
  241. <el-radio :label="1"> 开启 </el-radio>
  242. <el-radio :label="0"> 关闭 </el-radio>
  243. </el-radio-group>
  244. </el-form-item>
  245. <el-form-item
  246. label="兑换商品是否需要核销"
  247. prop="exchangeIsNeedVerification"
  248. >
  249. <el-radio-group v-model="formData.exchangeIsNeedVerification">
  250. <el-radio :label="1"> 是 </el-radio>
  251. <el-radio :label="0"> 否 </el-radio>
  252. </el-radio-group>
  253. </el-form-item>
  254. <el-form-item class="b-shop-rate" prop="score" label="评分">
  255. <el-rate v-model="formData.score"></el-rate>
  256. </el-form-item>
  257. <el-form-item prop="monthlySales" label="月售">
  258. <el-input
  259. v-model.number="formData.monthlySales"
  260. placeholder="请输入商家月售额"
  261. type="number"
  262. ></el-input>
  263. </el-form-item>
  264. <el-form-item prop="perCapita" label="人均">
  265. <el-input
  266. v-model.number="formData.perCapita"
  267. type="number"
  268. placeholder="请输入人均消费额"
  269. closeable
  270. ></el-input>
  271. </el-form-item>
  272. <el-form-item prop="shopBrief" label="商家简介">
  273. <el-input
  274. v-model="formData.shopBrief"
  275. autosize
  276. maxlength="250"
  277. show-word-limit
  278. type="textarea"
  279. placeholder="请输入商家简介"
  280. closeable
  281. ></el-input>
  282. </el-form-item>
  283. <el-form-item prop="advertisement" label="广告图">
  284. <!-- <el-upload
  285. class="avatar-uploader" list-type="picture-card" :file-list="formData.advertisement"
  286. :action="uploadUrl"
  287. :on-success="(r) => formData.advertisement.push({ url: r.url, uid: r.url + Math.random() + Date.now() })"
  288. :on-remove="(e) => formData.advertisement.filter((item) => item.uid !== e.uid)"
  289. >
  290. <i class="el-icon-plus avatar-uploader-icon" />
  291. </el-upload> -->
  292. <el-upload
  293. class="avatar-uploader"
  294. list-type="picture-card"
  295. :file-list="uploadList"
  296. :action="uploadUrl"
  297. :on-success="uploadSuccess"
  298. :on-remove="removeSuccess"
  299. >
  300. <i class="el-icon-plus avatar-uploader-icon" />
  301. </el-upload>
  302. </el-form-item>
  303. </el-tab-pane>
  304. <el-tab-pane label="客户信息" name="second">
  305. <el-form-item label="账号" prop="shopPhone" maxlength="20">
  306. <el-input
  307. ref="shopPhoneCls"
  308. v-model="formData.shopPhone"
  309. maxlength="20"
  310. />
  311. </el-form-item>
  312. <el-form-item label="密码" prop="shopPassword">
  313. <el-input
  314. v-model="formData.shopPassword"
  315. type="password"
  316. maxlength="16"
  317. />
  318. </el-form-item>
  319. </el-tab-pane>
  320. </el-tabs>
  321. </div>
  322. </el-form>
  323. </div>
  324. <template #footer>
  325. <span class="dialog-footer">
  326. <el-button size="mini" @click="handleClose">取 消</el-button>
  327. <el-button
  328. v-if="activeName === 'first'"
  329. type="primary"
  330. size="mini"
  331. @click="activeName = 'second'"
  332. >
  333. 下一步
  334. </el-button>
  335. <el-button
  336. v-else-if="activeName === 'second'"
  337. type="primary"
  338. size="mini"
  339. @click="handleSubmit"
  340. >确 定</el-button
  341. >
  342. </span>
  343. </template>
  344. </el-dialog>
  345. <!-- 选择经纬度 -->
  346. <SelectAddressMap
  347. ref="selectAddressMapRef"
  348. @select="
  349. (address) =>
  350. (formData.longitude = address[0]) && (formData.latitude = address[1])
  351. "
  352. ></SelectAddressMap>
  353. </div>
  354. </template>
  355. <script>
  356. import SelectAddressMap from "./SelectAddressMap";
  357. import {
  358. businessListGetById,
  359. businessListUpdate,
  360. businessListSave,
  361. businessClassList,
  362. } from "@/api/business";
  363. import { getProvinceList, getChildAreaList } from "@/api/address";
  364. import { uploadUrl } from "@/utils/request";
  365. import XeUtils from "xe-utils";
  366. export default {
  367. name: "EditModal",
  368. components: {
  369. SelectAddressMap,
  370. },
  371. data() {
  372. return {
  373. test: "119",
  374. modalOptions: {
  375. closeOnClickModal: false,
  376. width: "820px",
  377. title: "",
  378. },
  379. visible: false,
  380. formData: {
  381. shopId: "",
  382. shopName: "", // 店铺名称
  383. voucherCoinRatio: "", // 代金券提现比例
  384. isBeeCoin: "", // 是否支持消费金
  385. beeCoinRatio: "", // 商家消费金提现比例
  386. chargePersonName: "", // 店铺负责人
  387. chargePersonPhone: "", // 负责人电话
  388. shopAdress: "", // 地址
  389. effectiveDate: "", // 生效日期
  390. effectiveYear: "", // 生效年限
  391. shopType: 2, // 商家类型 1 商家 2 本地
  392. payType: 0, // 支付类型
  393. isVoucher: 1, // 是否支持代金卷 1 true 2 false
  394. voucherReturn: "",
  395. contractState: 1, // 合同状态 1-有效 0-无效
  396. auditLive: 1,
  397. auditLiveProduct: 1,
  398. exchangeIsNeedVerification: 0,
  399. shopPhone: "", // 账号
  400. shopPassword: "", // 密码
  401. perCapita: "", // 人均
  402. score: "", // 评分
  403. advertisement: [], // 广告图
  404. areaId: "", // 区域id
  405. hsbMrchId: "", // 惠市宝商家编号,不是必填
  406. longitude: "", // 经纬度
  407. latitude: "", // 经纬度
  408. classificationId: "", // 商家分类id
  409. classificationArr: [], // 非后端参数
  410. startTime: "",
  411. endTime: "",
  412. shopBrief: "", // 商家简介
  413. monthlySales: "",
  414. },
  415. formRules: {
  416. shopName: [{ required: true, message: "请输入店铺名称" }],
  417. effectiveDate: [{ required: true, message: "请输入生效日期" }],
  418. effectiveYear: [{ required: true, message: "请输入生效年限" }],
  419. chargePersonName: [
  420. { required: true, message: "请输入店铺负责人", trigger: "blur" },
  421. ],
  422. chargePersonPhone: [
  423. { required: true, message: "请输入负责人电话", trigger: "blur" },
  424. {
  425. pattern: /^1[3456789]\d{9}$/,
  426. message: "目前只支持中国大陆的手机号码",
  427. },
  428. ],
  429. shopAdress: [
  430. { required: true, message: "请输入地址", trigger: "blur" },
  431. ],
  432. contractState: [
  433. { required: true, message: "请选择合同状态", trigger: "change" },
  434. ],
  435. shopType: [
  436. { required: true, message: "请选择店铺类型", trigger: "change" },
  437. ],
  438. perCapita: [
  439. { required: true, message: "请输入人均消费额", trigger: "blur" },
  440. ],
  441. shopBrief: [
  442. { required: true, message: "请填写商家介绍", trigger: "blur" },
  443. ],
  444. isVoucher: [
  445. {
  446. required: true,
  447. message: "请选择是否允许使用代金卷",
  448. trigger: "change",
  449. },
  450. ],
  451. auditLive: [
  452. { required: true, message: "请选择状态", trigger: "change" },
  453. ],
  454. auditLiveProduct: [
  455. { required: true, message: "请选择状态", trigger: "change" },
  456. ],
  457. exchangeIsNeedVerification: [
  458. { required: true, message: "请选择状态", trigger: "change" },
  459. ],
  460. score: [
  461. { required: true, message: "请选择商家评分", trigger: "change" },
  462. ],
  463. monthlySales: [
  464. { required: true, message: "请输入商家月售额", trigger: "blur" },
  465. ],
  466. // advertisement: [ { required: true, message: '请上传广告图', trigger: 'trigger' } ],
  467. // classificationArr: [ { required: true, type: 'array', message: '请选择分类' } ],
  468. areaId: [{ required: true, message: "请选择地址", trigger: "blur" }],
  469. longitude: [
  470. { required: true, message: "请选择商家经纬度", trigger: "blur" },
  471. ],
  472. isBeeCoin: [{ required: true, message: "请选择是否支持消费金" }],
  473. beeCoinRatio: [],
  474. shopPhone: [
  475. { required: true, message: "请输入账号", trigger: "blur" },
  476. {
  477. pattern: /^1[3456789]\d{9}$/,
  478. message: "目前只支持中国大陆的手机号码",
  479. },
  480. ],
  481. shopPassword: [
  482. { required: true, message: "请输入密码", trigger: "blur" },
  483. {
  484. pattern: /^[~!@#$%^&*\-+=_.0-9a-zA-Z]{8,16}$/,
  485. message: "8-16密码数字英文混合",
  486. },
  487. ],
  488. },
  489. activeName: "first",
  490. regionArrDialog: [],
  491. regionProps: {
  492. lazy: true,
  493. label: "name",
  494. value: "id",
  495. lazyLoad(node, resolve) {
  496. const { level, value } = node;
  497. if (level === 0) {
  498. getProvinceList().then((res) => {
  499. resolve(res.data);
  500. });
  501. } else if (level != 0) {
  502. getChildAreaList(value).then((res) => {
  503. resolve(
  504. res.data.map((item) => {
  505. item.leaf = level === 3;
  506. return item;
  507. })
  508. );
  509. });
  510. }
  511. },
  512. },
  513. uploadUrl,
  514. categoryList: [],
  515. uploadList: [],
  516. };
  517. },
  518. watch: {
  519. "formData.isBeeCoin": {
  520. deep: true,
  521. handler(val) {
  522. if (val === 1) {
  523. this.formRules.beeCoinRatio = [
  524. { required: true, message: "请输入商家消费金提现比例" },
  525. {
  526. pattern: /^0\.\d{0,2}$|^[1-9]\d*\.\d{0,2}$|^[1-9]\d*$/,
  527. message: "数值有误",
  528. },
  529. ];
  530. } else {
  531. this.formRules.beeCoinRatio = [];
  532. }
  533. },
  534. },
  535. },
  536. created() {
  537. this.getCategoryTreeList();
  538. },
  539. methods: {
  540. handleSelectChange(val){
  541. this.formData.classificationId = val[val.length - 1]
  542. },
  543. // 递归获取id组
  544. handleClose() {
  545. this.visible = false;
  546. },
  547. async getCategoryTreeList() {
  548. const res = await businessClassList({ page: 1, pageSize: 9999 });
  549. XeUtils.eachTree(
  550. res.data.records,
  551. (item) => {
  552. if (Array.isArray(item.childs) && item.childs.length === 0) {
  553. item.childs = undefined;
  554. }
  555. },
  556. { children: "childs" }
  557. );
  558. this.categoryList = res.data.records;
  559. },
  560. initList() {},
  561. handleOpen(params = {}) {
  562. this.modalOptions.title = params.shopId ? "修改商家" : "新增商家";
  563. this.formData = Object.assign(this.$options.data().formData, params, {
  564. // advertisement: params.advertisement ? params.advertisement.split(',').map((item) => ({ url: item, uid: item + Math.random() + new Date() })) : []
  565. });
  566. // this.uploadList = this.formData.advertisement.split("&")
  567. const categoryItem = XeUtils.findTree(
  568. this.categoryList,
  569. (item) => item.id === String(params.classificationId)
  570. );
  571. if (categoryItem && Array.isArray(categoryItem.nodes)) {
  572. this.formData.classificationArr = categoryItem.nodes.map((v) => v.id);
  573. }
  574. if (this.formData.areaId) this.regionArrDialog = [this.formData.areaId];
  575. this.visible = true;
  576. this.initList();
  577. if (params.shopId) {
  578. this.getInfo(params.shopId);
  579. } else {
  580. this.$refs.formData && this.$refs.formData.resetFields();
  581. }
  582. },
  583. async getInfo(id) {
  584. const loading = this.$loading({ text: "加载中" });
  585. try {
  586. const res = await businessListGetById({ shopId: id });
  587. this.formData = Object.assign(this.$options.data().formData, res.data, {
  588. shopId: res.data.shopId || "",
  589. voucherReturn: Number(res.data.voucherReturn),
  590. // advertisement: res.data.advertisement ? res.data.advertisement.split(',').map((item) => ({ url: item, uid: item + Math.random() + new Date() })) : []
  591. // advertisement
  592. });
  593. const arr = this.formData.advertisement.split(",");
  594. if (arr[0] == "") {
  595. this.uploadList = [];
  596. } else {
  597. this.uploadList = arr.map((item) => ({
  598. url: item,
  599. uid: item + Math.random() + new Date(),
  600. }));
  601. }
  602. const categoryItem = XeUtils.findTree(
  603. this.categoryList,
  604. (item) => item.id === String(res.data.classificationId)
  605. );
  606. if (categoryItem && Array.isArray(categoryItem.nodes)) {
  607. this.formData.classificationArr = categoryItem.nodes.map((v) => v.id);
  608. }
  609. if (this.formData.areaId) this.regionArrDialog = [this.formData.areaId];
  610. this.$nextTick(() => {
  611. this.$refs.formData && this.$refs.formData.validate();
  612. });
  613. } finally {
  614. loading.close();
  615. }
  616. },
  617. handleSubmit() {
  618. this.$refs.formData.validate(async (valid) => {
  619. if (valid) {
  620. const loading = this.$loading({ text: "加载中" });
  621. try {
  622. const { advertisement, classificationArr, ...otps } = this.formData;
  623. const params = {
  624. ...otps,
  625. // advertisement: Array.isArray(advertisement) ? advertisement.map((v) => v.url || v).join(',') : '',
  626. // classificationId:
  627. // Array.isArray(classificationArr) && classificationArr.length
  628. // ? classificationArr[classificationArr.length - 1]
  629. // : "",
  630. };
  631. params.advertisement = this.uploadList.reduce(
  632. (prev, item, index) => {
  633. prev += item.url + ",";
  634. return prev;
  635. },
  636. ""
  637. );
  638. // 删除最后一个字符
  639. params.advertisement = params.advertisement.substring(
  640. 0,
  641. params.advertisement.length - 1
  642. );
  643. this.formData.shopId
  644. ? await businessListUpdate(params)
  645. : await businessListSave(params);
  646. loading.close();
  647. this.$message({
  648. message: `${this.formData.shopId ? "编辑" : "添加"}成功!`,
  649. type: "success",
  650. });
  651. this.$emit("success");
  652. this.visible = false;
  653. } catch (e) {
  654. loading.close();
  655. } finally {
  656. loading.close();
  657. }
  658. } else {
  659. this.$message({ message: "请输入相关信息", type: "warning" });
  660. return false;
  661. }
  662. });
  663. },
  664. uploadSuccess(r) {
  665. console.log(r);
  666. this.uploadList.push({
  667. url: r.data.url,
  668. uid: r.url + Math.random() + Date.now(),
  669. });
  670. },
  671. removeSuccess(r) {
  672. this.uploadList = this.uploadList.filter((item) => item.uid !== r.uid);
  673. },
  674. },
  675. };
  676. </script>