go-flow.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776
  1. <template>
  2. <div class="form-container">
  3. <div>
  4. <!-- 进度条 -->
  5. <el-button class="back-btn" @click="handleBack"> 返回 </el-button>
  6. <div class="progress-container">
  7. <el-steps :active="currentStep" style="max-width: 1500px" align-center>
  8. <el-step v-for="(item, index) in entryList" :key="index">
  9. <template #title>
  10. <div class="step-title-wrapper">
  11. <span class="step-title">{{ item.title }}</span>
  12. </div>
  13. </template>
  14. </el-step>
  15. </el-steps>
  16. </div>
  17. </div>
  18. <!-- 第一步:个人实名 -->
  19. <div v-if="currentStep === 1">
  20. <!-- 表单 -->
  21. <div class="form-content">
  22. <el-form :model="step1Form" :rules="step1Rules" ref="step1FormRef" label-width="120px">
  23. <el-form-item label="姓名" prop="name">
  24. <el-input v-model="step1Form.name" placeholder="请输入姓名" style="width: 400px" />
  25. </el-form-item>
  26. <el-form-item label="身份证号码" prop="idNumber">
  27. <el-input v-model="step1Form.idNumber" placeholder="请输入身份证号码" style="width: 400px" />
  28. </el-form-item>
  29. </el-form>
  30. </div>
  31. <!-- 按钮 -->
  32. <div class="form-actions">
  33. <el-button type="primary" size="large" @click="handleNextStep"> 下一步 </el-button>
  34. </div>
  35. </div>
  36. <!-- 第二步:填写信息 -->
  37. <div v-if="currentStep === 2">
  38. <!-- 表单内容 -->
  39. <div class="form-content step2-form">
  40. <el-form :model="step2Form" :rules="step2Rules" ref="step2FormRef" label-width="125px">
  41. <div class="form-row">
  42. <!-- 左列 -->
  43. <div class="form-col">
  44. <el-form-item label="店铺名称" prop="storeName">
  45. <el-input v-model="step2Form.storeName" placeholder="请输入店铺名称" />
  46. </el-form-item>
  47. <el-form-item label="容纳人数" prop="storeCapacity">
  48. <el-input-number v-model="step2Form.storeCapacity" :min="1" :max="9999" />
  49. </el-form-item>
  50. <el-form-item label="门店面积" prop="storeArea">
  51. <el-radio-group v-model="step2Form.storeArea">
  52. <el-radio label="小于20平米" value="1"> 小于20平米 </el-radio>
  53. <el-radio label="20-50平米" value="2"> 20-50平米 </el-radio>
  54. <el-radio label="50-100平米" value="3"> 50-100平米 </el-radio>
  55. <el-radio label="100-300平米" value="4"> 100-300平米 </el-radio>
  56. <el-radio label="500-1000平米" value="5"> 500-1000平米 </el-radio>
  57. <el-radio label="大于1000平米" value="6"> 大于1000平米 </el-radio>
  58. </el-radio-group>
  59. </el-form-item>
  60. <el-form-item label="所在地区" prop="region">
  61. <el-cascader :props="areaProps" v-model="step2Form.region" style="width: 100%" />
  62. </el-form-item>
  63. <el-form-item label="详细地址" prop="storeDetailAddress">
  64. <el-input v-model="step2Form.storeDetailAddress" type="textarea" :rows="3" placeholder="请输入" />
  65. </el-form-item>
  66. <el-form-item label="门店简介" prop="storeBlurb">
  67. <el-input v-model="step2Form.storeBlurb" type="textarea" :rows="3" placeholder="请输入" />
  68. </el-form-item>
  69. <el-form-item label="经营板块" prop="businessSection">
  70. <el-radio-group v-model="step2Form.businessSection" @change="changeBusinessSector">
  71. <el-radio
  72. v-for="businessSection in businessSectionList"
  73. :value="businessSection.value"
  74. :key="businessSection.value"
  75. >
  76. {{ businessSection.label }}
  77. </el-radio>
  78. </el-radio-group>
  79. </el-form-item>
  80. <el-form-item label="经营种类" prop="businessTypes">
  81. <el-checkbox-group v-model="step2Form.businessTypes">
  82. <el-checkbox
  83. v-for="businessType in businessTypeList"
  84. :key="businessType"
  85. :label="businessType.label"
  86. :value="businessType.value"
  87. />
  88. </el-checkbox-group>
  89. </el-form-item>
  90. </div>
  91. <!-- 右列 -->
  92. <div class="form-col">
  93. <el-form-item label="门店营业状态" prop="businessType">
  94. <el-radio-group v-model="step2Form.businessType">
  95. <el-radio label="正常营业"> 正常营业 </el-radio>
  96. <el-radio label="暂停营业"> 暂停营业 </el-radio>
  97. <el-radio label="筹建中"> 筹建中 </el-radio>
  98. </el-radio-group>
  99. </el-form-item>
  100. <el-form-item label="经度" prop="storePositionLongitude" v-show="latShow">
  101. <el-input disabled v-model="step2Form.storePositionLongitude" placeholder="请填写经度" clearable />
  102. </el-form-item>
  103. <el-form-item label="纬度" prop="storePositionLatitude" v-show="latShow">
  104. <el-input disabled v-model="step2Form.storePositionLatitude" placeholder="请填写纬度" clearable />
  105. </el-form-item>
  106. <el-form-item label="经纬度查询" prop="address">
  107. <el-select
  108. v-model="step2Form.address"
  109. filterable
  110. placeholder="请输入地址进行查询"
  111. remote
  112. reserve-keyword
  113. :remote-method="getLonAndLat"
  114. @change="selectAddress"
  115. >
  116. <el-option v-for="item in addressList" :key="item.id" :label="item.name" :value="item.location">
  117. <span style="float: left">{{ item.name }}</span>
  118. <span style="float: right; font-size: 13px; color: var(--el-text-color-secondary)">{{ item.district }}</span>
  119. </el-option>
  120. </el-select>
  121. </el-form-item>
  122. <el-form-item label="营业执照" prop="businessLicenseAddress">
  123. <el-upload
  124. v-model:file-list="step2Form.businessLicenseAddress"
  125. :http-request="handleHttpUpload"
  126. list-type="picture-card"
  127. :limit="1"
  128. :on-exceed="handleExceed"
  129. :on-success="handleUploadSuccess"
  130. >
  131. <el-icon><Plus /></el-icon>
  132. <template #tip>
  133. <div class="el-upload__tip">({{ step2Form.businessLicenseAddress.length }}/1)</div>
  134. </template>
  135. </el-upload>
  136. </el-form-item>
  137. <el-form-item label="合同图片" prop="contractImageList">
  138. <el-upload
  139. v-model:file-list="step2Form.contractImageList"
  140. :http-request="handleHttpUpload"
  141. list-type="picture-card"
  142. :limit="20"
  143. :on-exceed="handleExceed"
  144. :on-success="handleUploadSuccess"
  145. >
  146. <el-icon><Plus /></el-icon>
  147. <template #tip>
  148. <div class="el-upload__tip">({{ step2Form.contractImageList.length }}/20)</div>
  149. </template>
  150. </el-upload>
  151. </el-form-item>
  152. <el-form-item label="食品经营许可证" prop="foodLicenceImgList">
  153. <el-upload
  154. v-model:file-list="step2Form.foodLicenceImgList"
  155. :http-request="handleHttpUpload"
  156. list-type="picture-card"
  157. :limit="1"
  158. :on-exceed="handleExceed"
  159. :on-success="handleUploadSuccess"
  160. >
  161. <el-icon><Plus /></el-icon>
  162. <template #tip>
  163. <div class="el-upload__tip">({{ step2Form.foodLicenceImgList.length }}/1)</div>
  164. </template>
  165. </el-upload>
  166. </el-form-item>
  167. </div>
  168. </div>
  169. </el-form>
  170. </div>
  171. <!-- 按钮 -->
  172. <div class="form-actions">
  173. <el-button type="primary" size="large" @click="handleSubmit"> 提交 </el-button>
  174. </div>
  175. </div>
  176. <!-- 第三步: 等待审核-->
  177. <div v-if="currentStep === 3">
  178. <div class="button-container">
  179. <el-button type="danger" size="large" class="register-btn-red" @click="changeRefuse" v-if="storeApplicationStatus == 2">
  180. 审核拒绝,重新入驻
  181. </el-button>
  182. <el-button type="primary" size="large" class="register-btn" v-else> 等待审核 </el-button>
  183. </div>
  184. </div>
  185. </div>
  186. </template>
  187. <script setup lang="ts">
  188. import { ref, reactive, watch, onMounted } from "vue";
  189. import {
  190. ElMessage,
  191. ElMessageBox,
  192. type FormInstance,
  193. type FormRules,
  194. UploadProps,
  195. UploadUserFile,
  196. UploadRequestOptions
  197. } from "element-plus";
  198. import { Plus } from "@element-plus/icons-vue";
  199. import { verifyIdInfo, applyStore } from "@/api/modules/homeEntry";
  200. import { getBusinessSection, getBusinessSectionTypes, getInputPrompt, getDistrict, uploadImg } from "@/api/modules/newLoginApi";
  201. import { localGet } from "@/utils/index";
  202. const userInfo = localGet("geeker-user")?.userInfo || {};
  203. const latShow = ref(false);
  204. onMounted(() => {
  205. getBusinessSectionList();
  206. getBusinessTypes(null);
  207. callGetUserInfo();
  208. });
  209. const entryList = ref([
  210. {
  211. title: "个人实名"
  212. },
  213. {
  214. title: "填写信息"
  215. },
  216. {
  217. title: "等待审核"
  218. },
  219. {
  220. title: "入驻成功"
  221. }
  222. ]);
  223. const step2Rules: FormRules = {
  224. storeName: [{ required: true, message: "请输入店铺名称", trigger: "blur" }],
  225. storeArea: [{ required: true, message: "请选择门店面积", trigger: "change" }],
  226. storeBlurb: [{ required: true, message: "请输入门店简介", trigger: "change" }],
  227. storeIntro: [{ required: true, message: "请输入门店简介", trigger: "blur" }],
  228. businessSection: [{ required: true, message: "请选择经营板块", trigger: "change" }],
  229. businessTypes: [{ required: true, message: "请选择经营种类", trigger: "change" }],
  230. address: [{ required: true, message: "请输入经纬度", trigger: "blur" }],
  231. businessLicenseAddress: [{ required: true, message: "请上传营业执照", trigger: "change" }],
  232. contractImageList: [{ required: true, message: "请上传合同图片", trigger: "change" }],
  233. foodLicenceImgList: [{ required: true, message: "请上传食品经营许可证", trigger: "change" }]
  234. };
  235. //地址集合
  236. const addressList = ref<any[]>([]);
  237. //查询地址名称
  238. const queryAddress = ref<string>("");
  239. const props = defineProps({
  240. currentStep: {
  241. type: Number,
  242. value: 0
  243. },
  244. storeApplicationStatus: {
  245. type: Number,
  246. value: 0
  247. }
  248. });
  249. const emit = defineEmits(["update:currentStep", "update:get-user-info"]);
  250. // 调用父组件的 getUserInfo 方法
  251. const callGetUserInfo = () => {
  252. emit("update:get-user-info");
  253. };
  254. // 内部步骤状态,和父组件同步
  255. const currentStep = ref<number>(props.currentStep || 0);
  256. const storeApplicationStatus = ref<number>(props.storeApplicationStatus || 0);
  257. console.log(storeApplicationStatus);
  258. watch(
  259. () => props.currentStep,
  260. val => {
  261. if (typeof val === "number") currentStep.value = val;
  262. }
  263. );
  264. watch(
  265. () => props.storeApplicationStatus,
  266. val => {
  267. if (typeof val === "number") storeApplicationStatus.value = val;
  268. }
  269. );
  270. const changeRefuse = () => {
  271. currentStep.value = 2;
  272. };
  273. const setStep = (val: number) => {
  274. currentStep.value = val;
  275. emit("update:currentStep", val);
  276. };
  277. // 第一步表单
  278. const step1FormRef = ref<FormInstance>();
  279. const step1Form = reactive({
  280. name: "",
  281. idNumber: ""
  282. });
  283. const step1Rules: FormRules = {
  284. name: [{ required: true, message: "请输入姓名", trigger: "blur" }],
  285. idNumber: [
  286. { required: true, message: "请输入身份证号码", trigger: "blur" },
  287. {
  288. pattern: /^[1-9]\d{5}(18|19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}[\dXx]$/,
  289. message: "请输入正确的身份证号码",
  290. trigger: "blur"
  291. }
  292. ]
  293. };
  294. // 第二步表单
  295. const step2FormRef = ref<FormInstance>();
  296. const step2Form = reactive({
  297. storeName: "", //门店名称
  298. storeCapacity: 1, //容纳人数
  299. storeArea: "1", //门店面积
  300. isChain: 0, //是否连锁
  301. storeDetailAddress: "", //详细地址
  302. region: [],
  303. administrativeRegionProvinceAdcode: "", //省
  304. administrativeRegionCityAdcode: "", //市
  305. administrativeRegionDistrictAdcode: "", //区
  306. storeAddress: "", //门店地址(完整地址)
  307. storeBlurb: "", //门店简介
  308. businessSection: "", //经营板块
  309. businessSectionName: "KTV",
  310. businessTypes: [], //经营种类
  311. businessTypesList: [], //经营种类集合
  312. businessStatus: 0, //营业状态
  313. storeStatus: 1, //门店状态
  314. businessType: "正常营业", //门店营业状态(用于表单显示)
  315. storePositionLongitude: "", //经度
  316. storePositionLatitude: "", //纬度
  317. businessLicenseAddress: [] as UploadUserFile[], //营业执照地址
  318. contractImageList: [] as UploadUserFile[], //合同图片集合
  319. foodLicenceImgList: [] as UploadUserFile[], //食品经营许可证
  320. address: ""
  321. });
  322. // 返回按钮
  323. const handleBack = () => {
  324. if (currentStep.value === 1) {
  325. setStep(0);
  326. } else if (currentStep.value === 2) {
  327. setStep(1);
  328. } else if (currentStep.value === 3) {
  329. setStep(2);
  330. }
  331. };
  332. // 地区选择
  333. const areaProps: any = {
  334. lazy: true,
  335. async lazyLoad(node, resolve) {
  336. const { level } = node;
  337. try {
  338. let param = { adCode: node.data.adCode ? node.data.adCode : "" };
  339. // 调用后台接口获取数据
  340. const response: any = await getDistrict(param as any);
  341. // 转换数据格式
  342. const nodes = (response?.data?.districts?.[0]?.districts || []).map((item: any) => ({
  343. value: item.adcode,
  344. adCode: item.adcode,
  345. label: item.name,
  346. leaf: level >= 2 // 假设最多三级,可以根据实际需求调整
  347. }));
  348. console.log(nodes);
  349. // 返回数据
  350. resolve(nodes);
  351. } catch (error) {
  352. resolve([]);
  353. }
  354. }
  355. };
  356. watch(
  357. () => step2Form.region,
  358. (newVal: any[]) => {
  359. if (newVal.length > 0) {
  360. step2Form.administrativeRegionProvinceAdcode = newVal[0];
  361. step2Form.administrativeRegionCityAdcode = newVal[1];
  362. step2Form.administrativeRegionDistrictAdcode = newVal[2];
  363. }
  364. }
  365. );
  366. //经营板块
  367. const businessSectionList = ref<any[]>([]);
  368. const getBusinessSectionList = async () => {
  369. let res: any = await getBusinessSection();
  370. let addData: any[] = [];
  371. (res?.data || []).forEach((element: any) => {
  372. addData.push({ value: element.dictId, label: element.dictDetail, parentId: element.parentId });
  373. });
  374. businessSectionList.value = addData;
  375. // 如果businessSection有默认值,自动设置对应的id和name
  376. if (step2Form.businessSection) {
  377. const selectedSection = addData.find((item: any) => item.value === step2Form.businessSection);
  378. if (selectedSection) {
  379. step2Form.businessSection = selectedSection.value;
  380. step2Form.businessSectionName = selectedSection.label;
  381. }
  382. }
  383. };
  384. const changeBusinessSector = async (val: any) => {
  385. // 根据选中的value从businessSectionList中查找对应的项
  386. const selectedSection = businessSectionList.value.find((item: any) => item.value === val);
  387. if (selectedSection) {
  388. step2Form.businessSection = selectedSection.value; // dictId
  389. step2Form.businessSectionName = selectedSection.label; // dictDetail
  390. } else {
  391. step2Form.businessSection = "";
  392. step2Form.businessSectionName = "";
  393. }
  394. // 清空之前选中的经营种类
  395. step2Form.businessTypesList = [];
  396. step2Form.businessTypes = [];
  397. getBusinessTypes(val);
  398. };
  399. //经营种类
  400. const businessTypeList = ref<any[]>([]);
  401. const getBusinessTypes = async (val: any) => {
  402. let res: any = await getBusinessSectionTypes({ parentId: val ? val : step2Form.businessSection });
  403. let addData1: any[] = [];
  404. (res?.data || []).forEach((element: any) => {
  405. addData1.push({ value: element.dictId, label: element.dictDetail });
  406. });
  407. businessTypeList.value = addData1;
  408. };
  409. // 经纬度查询
  410. const getLonAndLat = async (keyword: string) => {
  411. if (keyword) {
  412. console.log("地址查询", keyword);
  413. let param = {
  414. addressName: keyword
  415. };
  416. let res: any = await getInputPrompt(param as any);
  417. if (res.code == "200") {
  418. addressList.value = res?.data?.tips || [];
  419. console.log("res", res);
  420. } else {
  421. ElMessage.error("新增失败!");
  422. }
  423. } else {
  424. addressList.value = [];
  425. }
  426. };
  427. const selectAddress = async (param: any) => {
  428. let locationList = step2Form.address.split(",");
  429. addressList.value.forEach((item: any) => {
  430. if (item.location == step2Form.address) {
  431. queryAddress.value = item.name;
  432. }
  433. });
  434. step2Form.storePositionLongitude = locationList[0];
  435. step2Form.storePositionLatitude = locationList[1];
  436. latShow.value = true;
  437. };
  438. //文件上传
  439. const handleHttpUpload = async (options: UploadRequestOptions) => {
  440. let formData = new FormData();
  441. formData.append("file", options.file);
  442. try {
  443. const res: any = await uploadImg(formData);
  444. // 上传成功,将URL保存到文件对象中
  445. const fileUrl = res?.data?.fileUrl || res?.data?.[0] || res?.fileUrl;
  446. if (fileUrl) {
  447. // 调用 onSuccess 回调,传入响应数据
  448. options.onSuccess({ fileUrl });
  449. } else {
  450. throw new Error("上传失败:未获取到文件URL");
  451. }
  452. } catch (error) {
  453. options.onError(error as any);
  454. ElMessage.error("文件上传失败,请重试");
  455. }
  456. };
  457. // 文件上传成功回调
  458. const handleUploadSuccess = (response: any, uploadFile: UploadUserFile) => {
  459. // 将URL保存到文件对象中
  460. if (response?.fileUrl) {
  461. uploadFile.url = response.fileUrl;
  462. }
  463. };
  464. // 下一步
  465. const handleNextStep = async () => {
  466. if (!step1FormRef.value) return;
  467. await step1FormRef.value.validate(async valid => {
  468. if (valid) {
  469. const params = {
  470. name: step1Form.name,
  471. idCard: step1Form.idNumber,
  472. appType: 1
  473. };
  474. const res: any = await verifyIdInfo(params);
  475. if (res && res.code == 200) {
  476. ElMessage.success(res.msg);
  477. setStep(2);
  478. }
  479. } else {
  480. ElMessage.error("请完善表单信息");
  481. }
  482. });
  483. };
  484. // 提取文件列表中的URL
  485. const getFileUrls = (fileList: UploadUserFile[]): string[] => {
  486. return fileList
  487. .map((file: UploadUserFile) => {
  488. // 优先使用 url,如果没有则使用 response 中的 fileUrl
  489. const response = file.response as any;
  490. return file.url || response?.fileUrl || "";
  491. })
  492. .filter((url: string) => url); // 过滤掉空字符串
  493. };
  494. // 根据adcode获取地区详细信息
  495. const getDistrictInfo = async (adcode: string) => {
  496. try {
  497. const response: any = await getDistrict({ adCode: adcode } as any);
  498. const district = response?.data?.districts?.[0];
  499. if (district) {
  500. return {
  501. citycode: district.citycode ? [district.citycode] : [],
  502. adcode: district.adcode,
  503. level: district.level,
  504. center: district.center,
  505. name: district.name,
  506. districts: []
  507. };
  508. }
  509. } catch (error) {
  510. console.error("获取地区信息失败:", error);
  511. }
  512. return null;
  513. };
  514. // 构建whereAddress数组
  515. const buildWhereAddress = async (regionCodes: string[]) => {
  516. const whereAddress: any[] = [];
  517. if (regionCodes && regionCodes.length > 0) {
  518. for (const code of regionCodes) {
  519. const districtInfo = await getDistrictInfo(code);
  520. if (districtInfo) {
  521. whereAddress.push(districtInfo);
  522. }
  523. }
  524. }
  525. return whereAddress;
  526. };
  527. // 提交
  528. const handleSubmit = async () => {
  529. if (!step2FormRef.value) return;
  530. await step2FormRef.value.validate(async valid => {
  531. if (valid) {
  532. // 提取上传图片的URL
  533. const businessLicenseUrls = getFileUrls(step2Form.businessLicenseAddress);
  534. const contractImageUrls = getFileUrls(step2Form.contractImageList);
  535. const foodLicenceUrls = getFileUrls(step2Form.foodLicenceImgList);
  536. // 构建whereAddress数组
  537. const whereAddress = await buildWhereAddress(step2Form.region);
  538. // 处理营业状态映射
  539. let storeStatus = 1; // 默认值
  540. if (step2Form.businessType === "正常营业") {
  541. storeStatus = 1;
  542. } else if (step2Form.businessType === "暂停营业") {
  543. storeStatus = 0;
  544. } else if (step2Form.businessType === "筹建中") {
  545. storeStatus = 2;
  546. }
  547. // 处理门店面积:转换为数字
  548. const storeAreaNum = typeof step2Form.storeArea === "string" ? parseInt(step2Form.storeArea) : step2Form.storeArea;
  549. // 构建地址对象
  550. const addressObj = {
  551. address: queryAddress.value || "",
  552. longitude: parseFloat(step2Form.storePositionLongitude) || 0,
  553. latitude: parseFloat(step2Form.storePositionLatitude) || 0
  554. };
  555. // 构建门店位置字符串
  556. const storePosition =
  557. step2Form.storePositionLongitude && step2Form.storePositionLatitude
  558. ? `${step2Form.storePositionLongitude},${step2Form.storePositionLatitude}`
  559. : "";
  560. // 构建完整地址(省市区+详细地址)
  561. let fullStoreAddress = "";
  562. if (whereAddress.length > 0) {
  563. const provinceName = whereAddress[0]?.name || "";
  564. const cityName = whereAddress[1]?.name || "";
  565. const districtName = whereAddress[2]?.name || "";
  566. fullStoreAddress = `${provinceName}${cityName}${districtName}`;
  567. }
  568. const params = {
  569. storeTel: userInfo.phone,
  570. storeName: step2Form.storeName,
  571. storeCapacity: step2Form.storeCapacity,
  572. storeArea: storeAreaNum,
  573. isChain: step2Form.isChain,
  574. storeDetailAddress: step2Form.storeDetailAddress,
  575. storeBlurb: step2Form.storeBlurb,
  576. businessSection: step2Form.businessSection,
  577. businessTypesList: step2Form.businessTypes.length > 0 ? step2Form.businessTypes : step2Form.businessTypesList,
  578. storeStatus: storeStatus,
  579. businessStatus: step2Form.businessStatus,
  580. address: addressObj,
  581. businessLicenseAddress: businessLicenseUrls,
  582. contractImageList: contractImageUrls,
  583. foodLicenceImgList: foodLicenceUrls,
  584. storeAddress: fullStoreAddress,
  585. whereAddress: whereAddress,
  586. updatedTime: null,
  587. queryAddress: queryAddress.value,
  588. storePosition: storePosition,
  589. storePositionLatitude: parseFloat(step2Form.storePositionLatitude) || 0,
  590. storePositionLongitude: parseFloat(step2Form.storePositionLongitude) || 0,
  591. businessSectionName: step2Form.businessSectionName,
  592. businessTypes: step2Form.businessTypes.length > 0 ? step2Form.businessTypes : step2Form.businessTypesList,
  593. foodLicenceUrl: foodLicenceUrls.length > 0 ? foodLicenceUrls[0] : "",
  594. userAccount: userInfo.id, // 需要从用户信息中获取
  595. administrativeRegionProvinceAdcode: step2Form.administrativeRegionProvinceAdcode,
  596. administrativeRegionCityAdcode: step2Form.administrativeRegionCityAdcode,
  597. administrativeRegionDistrictAdcode: step2Form.administrativeRegionDistrictAdcode,
  598. storeContact: step1Form.name,
  599. idCard: step1Form.idNumber
  600. };
  601. ElMessageBox.confirm("确认提交入驻申请吗?", "提示", {
  602. confirmButtonText: "确定",
  603. cancelButtonText: "取消",
  604. type: "warning"
  605. })
  606. .then(async () => {
  607. try {
  608. const res: any = await applyStore(params);
  609. if (res && res.code == 200) {
  610. setStep(3); // 跳转到等待审核步骤
  611. ElMessage.success(res.msg);
  612. } else {
  613. ElMessage.error(res.msg || "提交失败");
  614. }
  615. } catch (error) {
  616. ElMessage.error("提交失败,请重试");
  617. }
  618. })
  619. .catch(() => {
  620. // 取消提交
  621. });
  622. } else {
  623. ElMessage.error("请完善表单信息");
  624. }
  625. });
  626. };
  627. // 文件上传超出限制
  628. const handleExceed = () => {
  629. ElMessage.warning("文件数量超出限制");
  630. };
  631. </script>
  632. <style scoped lang="scss">
  633. // 表单页面样式
  634. .form-container {
  635. min-height: calc(100vh - 100px);
  636. padding: 30px;
  637. background: #ffffff;
  638. border-radius: 8px;
  639. .back-btn {
  640. margin-bottom: 30px;
  641. color: #606266;
  642. border-color: #dcdfe6;
  643. }
  644. .progress-container {
  645. margin-bottom: 40px;
  646. :deep(.el-step__head.is-process .el-step__icon) {
  647. color: #909399;
  648. border-color: #909399 !important; /* 设置圆圈边框为灰色 */
  649. }
  650. :deep(.el-steps) {
  651. .el-step__head {
  652. .el-step__icon {
  653. width: 30px;
  654. height: 30px;
  655. font-size: 16px;
  656. font-weight: 600;
  657. }
  658. }
  659. .el-step__title {
  660. .step-title-wrapper {
  661. display: flex;
  662. flex-direction: column;
  663. gap: 8px;
  664. align-items: center;
  665. .step-title {
  666. font-size: 16px;
  667. font-weight: 600;
  668. color: #6c8ff8;
  669. }
  670. }
  671. }
  672. }
  673. }
  674. .form-content {
  675. max-width: 800px;
  676. margin: 0 auto;
  677. &.step2-form {
  678. max-width: 100%;
  679. .form-row {
  680. display: flex;
  681. gap: 40px;
  682. .form-col {
  683. flex: 1;
  684. }
  685. }
  686. }
  687. }
  688. .form-actions {
  689. display: flex;
  690. gap: 20px;
  691. justify-content: center;
  692. padding-top: 30px;
  693. margin-top: 40px;
  694. border-top: 1px solid #e4e7ed;
  695. .el-button {
  696. width: 200px;
  697. height: 44px;
  698. font-size: 16px;
  699. font-weight: 500;
  700. color: #ffffff;
  701. background: #6c8ff8;
  702. border: none;
  703. border-radius: 4px;
  704. outline: none;
  705. }
  706. }
  707. }
  708. .button-container {
  709. display: flex;
  710. align-items: center;
  711. justify-content: center;
  712. .register-btn {
  713. width: 200px;
  714. height: 44px;
  715. font-size: 16px;
  716. font-weight: 500;
  717. background: #6c8ff8;
  718. border: 0;
  719. border-radius: 4px;
  720. outline: none;
  721. }
  722. .register-btn-red {
  723. width: 200px;
  724. height: 44px;
  725. font-size: 16px;
  726. font-weight: 500;
  727. border: 0;
  728. border-radius: 4px;
  729. outline: none;
  730. }
  731. }
  732. </style>