edit_settled_store.js 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882
  1. /*
  2. * 入驻店铺管理——编辑入驻店铺信息
  3. * */
  4. import { connect } from 'dva/index';
  5. import React, { Component, Fragment } from 'react';
  6. import { Form, Table, Tooltip, } from 'antd';
  7. import {
  8. failTip,
  9. getSldHorLine,
  10. sldLlineRtextAddGoods,
  11. sldIconBtnBg,
  12. sldCommonTitle,
  13. sldComLanguage,
  14. getSldEmptyH,
  15. sucTip,
  16. sldSvgIcon,
  17. list_com_page_more,
  18. mobile_reg,
  19. } from '@/utils/utils';
  20. import global from '@/global.less';
  21. import router from 'umi/router';
  22. import { Scrollbars } from 'react-custom-scrollbars';
  23. import SldTableRowTwo from '@/components/SldTableRowTwo';
  24. import areaData from '@/assets/area.json';
  25. import { apiUrl } from '@/utils/sldconfig.js';
  26. import { week_to_num, month_to_num } from '@/utils/util_data';
  27. import SldPreviewImg from '@/components/SldPreviewImg/SldPreviewImg';
  28. import defaultSettings from '@/defaultSettings';
  29. let sthis = '';
  30. const FormItem = Form.Item;
  31. @connect(({ store, global, share }) => ({
  32. store, global, share
  33. }))
  34. @Form.create()
  35. export default class EditSettledStore extends Component {
  36. constructor(props) {
  37. super(props);
  38. sthis = this;
  39. const {
  40. form: { getFieldDecorator },
  41. } = props;
  42. this.state = {
  43. show_preview_modal: false,//预览图片modal框是否展示
  44. preview_img: '',//预览图片
  45. preview_alt_con: '',//预览图片内容
  46. show_radio_flag: false,
  47. query: props.location.query,
  48. siteList: [],
  49. storeGradeIdList: {},
  50. openTimeList: {},
  51. currentSite: {}, // 当前站点
  52. store_detail: {},
  53. store_base_info: [{ //店铺信息
  54. type: 'show_text',
  55. label: `${sldComLanguage('入驻类型')}`,
  56. name: 'enterTypeValue',
  57. extra: ``,
  58. text: ``,
  59. }, {
  60. type: 'cascader_common',
  61. label: `${sldComLanguage('所在地')}`,
  62. name: 'area',
  63. data: areaData,//三级地址
  64. fieldNames: { label: 'regionName', value: 'regionCode', children: 'children' },
  65. placeholder: `${sldComLanguage('请选择店铺所在地')}`,//请选择店铺所在地
  66. initialValue: [],
  67. required: true,
  68. onChange: this.getAreaInfo,
  69. rules: [{
  70. required: true,
  71. message: `${sldComLanguage('请选择店铺所在地')}`,//请选择店铺所在地
  72. }],
  73. }, {
  74. type: 'textarea',
  75. maxLength: 40,
  76. label: `${sldComLanguage('详细地址')}`,
  77. name: 'companyAddress',
  78. placeholder: `${sldComLanguage('请输入店铺详细地址,最多40字')}`,
  79. initialValue: '',
  80. required: true,
  81. rules: [{
  82. required: true,
  83. message: `${sldComLanguage('请输入详细地址')}`,
  84. }],
  85. }, {
  86. type: 'input',
  87. maxLength: 6,
  88. label: `${sldComLanguage('联系人')}`,
  89. name: 'contactName',
  90. placeholder: `${sldComLanguage('请输入联系人姓名,最多6个字')}`,
  91. initialValue: '',
  92. required: true,
  93. rules: [{
  94. required: true,
  95. message: `${sldComLanguage('请输入联系人姓名')}`,
  96. }],
  97. }, {
  98. type: 'input',
  99. label: `${sldComLanguage('联系人手机号')}`,
  100. name: 'contactPhone',
  101. placeholder: `${sldComLanguage('请输入联系人手机号')}`,
  102. initialValue: '',
  103. required: true,
  104. rules: [{
  105. required: true,
  106. message: `${sldComLanguage('请输入联系人手机号')}`,
  107. }, {
  108. pattern: mobile_reg,
  109. message: `${sldComLanguage('请输入正确的手机号')}`,
  110. }],
  111. }],
  112. personal_front_card_img: [{
  113. type: 'upload_img_upload',
  114. label: `${sldComLanguage('身份证正面')}`,
  115. name: 'personCardUp',
  116. extra: `${sldComLanguage('支持JPG/PNG,大小不超过20M')}`,
  117. fileList: [],
  118. upload_name: 'file',
  119. upload_url: apiUrl + `v3/oss/common/upload?source=sellerApply`,
  120. uploadPreview: this.uploadImgPre,
  121. uploadChange: (info) => this.uploadImg('personal_front_card_img', 'personCardUp', info),
  122. initialValue: '',
  123. img_succ_info: {},
  124. required: true,
  125. num: 1,
  126. item_height: 160,
  127. }, {
  128. type: 'upload_img_upload',
  129. label: `${sldComLanguage('身份证反面')}`,
  130. name: 'personCardDown',
  131. extra: `${sldComLanguage('支持JPG/PNG,大小不超过20M')}`,
  132. fileList: [],
  133. upload_name: 'file',
  134. upload_url: apiUrl + `v3/oss/common/upload?source=sellerApply`,
  135. uploadPreview: this.uploadImgPre,
  136. uploadChange: (info) => this.uploadImg('personal_front_card_img', 'personCardDown', info),
  137. initialValue: '',
  138. img_succ_info: {},
  139. required: true,
  140. num: 1,
  141. item_height: 160,
  142. }],//身份证正面信息
  143. business_license_img: [{
  144. type: 'upload_img_upload',
  145. label: `${sldComLanguage('营业执照')}`,
  146. name: 'businessLicenseImage',
  147. extra: `${sldComLanguage('支持JPG/PNG,大小不超过20M')}`,
  148. fileList: [],
  149. upload_name: 'file',
  150. upload_url: apiUrl + `v3/oss/common/upload?source=sellerApply`,
  151. uploadPreview: this.uploadImgPre,
  152. uploadChange: (info) => this.uploadImg('business_license_img', 'businessLicenseImage', info),
  153. initialValue: '',
  154. img_succ_info: {},
  155. required: true,
  156. num: 1,
  157. item_height: 160,
  158. }],//营业执照信息——企业入驻
  159. replenish_img: [{
  160. type: 'upload_img_upload',
  161. label: `${sldComLanguage('补充认证一')}`,
  162. name: 'moreQualification1',
  163. extra: `${sldComLanguage('支持JPG/PNG,大小不超过20M')}`,
  164. fileList: [],
  165. upload_name: 'file',
  166. upload_url: apiUrl + `v3/oss/common/upload?source=sellerApply`,
  167. uploadPreview: this.uploadImgPre,
  168. uploadChange: (info) => this.uploadImg('replenish_img', 'moreQualification1', info),
  169. initialValue: '',
  170. img_succ_info: {},
  171. num: 1,
  172. item_height: 160,
  173. }, {
  174. type: 'upload_img_upload',
  175. label: `${sldComLanguage('补充认证二')}`,
  176. name: 'moreQualification2',
  177. extra: `${sldComLanguage('支持JPG/PNG,大小不超过20M')}`,
  178. fileList: [],
  179. upload_name: 'file',
  180. upload_url: apiUrl + `v3/oss/common/upload?source=sellerApply`,
  181. uploadPreview: this.uploadImgPre,
  182. uploadChange: (info) => this.uploadImg('replenish_img', 'moreQualification2', info),
  183. initialValue: '',
  184. img_succ_info: {},
  185. num: 1,
  186. item_height: 160,
  187. }, {
  188. type: 'upload_img_upload',
  189. label: `${sldComLanguage('补充认证三')}`,
  190. name: 'moreQualification3',
  191. extra: `${sldComLanguage('支持JPG/PNG,大小不超过20M`')}`,
  192. fileList: [],
  193. upload_name: 'file',
  194. upload_url: apiUrl + `v3/oss/common/upload?source=sellerApply`,
  195. uploadPreview: this.uploadImgPre,
  196. uploadChange: (info) => this.uploadImg('replenish_img', 'moreQualification3', info),
  197. initialValue: '',
  198. img_succ_info: {},
  199. num: 1,
  200. item_height: 160,
  201. }],//补充认证信息——企业入驻
  202. store_business_info: [{
  203. type: 'show_text',
  204. label: `${sldComLanguage('店铺名称')}`,
  205. name: 'storeName',
  206. extra: ``,
  207. text: ``,
  208. }, {
  209. type: 'select',
  210. label: `${sldComLanguage('店铺等级')}`,
  211. name: 'storeGradeId',
  212. sel_data: [],
  213. sele_key: 'gradeId',
  214. sele_name: 'gradeName',
  215. diy: true,
  216. required: true,
  217. rules: [{
  218. required: true,
  219. message: `${sldComLanguage('请选择店铺等级')}`,
  220. }],
  221. },
  222. {
  223. type: 'select',
  224. label: `${sldComLanguage('开店时长')}`,
  225. name: 'openTime',
  226. placeholder: `${sldComLanguage('请选择开店时长')}`,
  227. sel_data: [],
  228. required: true,
  229. rules: [{
  230. required: true,
  231. message: `${sldComLanguage('请选择开店时长')}`,
  232. }],
  233. }
  234. ],//店铺经营信息
  235. settle_info: [{
  236. type: 'radio',
  237. label: `${sldComLanguage('结算日')}`,
  238. name: 'billCycle',
  239. required: true,
  240. sel_data: [
  241. { name: `${sldComLanguage('按月结算')}`, key: 1 },
  242. { name: `${sldComLanguage('按周结算')}`, key: 2 },
  243. ],
  244. isReset: true,
  245. initialValue: 1,
  246. onChange: this.switchBillType,
  247. }],// 结算信息
  248. columns: [{
  249. title: ' ',
  250. dataIndex: 'key',
  251. align: 'center',
  252. width: 30,
  253. render: (text, record, index) => {
  254. return index + 1;
  255. },
  256. }, {
  257. title: `${sldComLanguage('一级类目')}`,
  258. dataIndex: 'goodsCateName1',
  259. align: 'center',
  260. width: 100,
  261. }, {
  262. title: `${sldComLanguage('二级类目')}`,
  263. dataIndex: 'goodsCateName2',
  264. align: 'center',
  265. width: 100,
  266. }, {
  267. title: `${sldComLanguage('三级类目')}`,
  268. dataIndex: 'goodsCateName3',
  269. align: 'center',
  270. width: 100,
  271. },
  272. // {
  273. // title: <div style={{ position: 'relative' }}>
  274. // <span style={{ color: '#FF2929', fontSize: 13 }}>*</span>{sldComLanguage('佣金比例')}<Tooltip placement="bottomLeft"
  275. // title={sldComLanguage('佣金比例在0~1之间')}>
  276. // <div style={{ right: -15, top: 2, position: 'absolute' }}>{sldSvgIcon('#bfbbba', 14, 14, 'wen')}</div>
  277. // </Tooltip>
  278. // </div>,
  279. // dataIndex: 'scaling',
  280. // align: 'center',
  281. // width: 100,
  282. // }
  283. ],//经营类目数据
  284. resList: [], // 取消原因数据
  285. modalVisible: false,
  286. titleName: '',
  287. submiting: false,
  288. modal_width: 500,
  289. };
  290. }
  291. sel_area_name = '';//选择店铺地址的文本内容
  292. week_data = {
  293. type: 'checkboxgroup',
  294. label: `${sldComLanguage('结算日')}`,
  295. extra: `${sldComLanguage('设置该商家每周几进行结算,可多选,全部选中则为按天结算。')}`,
  296. name: 'billDays',
  297. placeholder: `${sldComLanguage('请选择结算日')}`,
  298. sldOptions: week_to_num(),
  299. rules: [{
  300. required: true,
  301. message: `${sldComLanguage('请选择结算日')}`,
  302. }],
  303. item_height: 100,
  304. };
  305. month_data = {
  306. type: 'checkboxgroup',
  307. label: `${sldComLanguage('结算日')}`,
  308. extra: `${sldComLanguage('设置该商家每月几号进行结算,可多选,若当月没有设置的日期则该日不进行结算。')}`,
  309. name: 'billDays',
  310. placeholder: `${sldComLanguage('请选择结算日')}`,
  311. sldOptions: month_to_num(),
  312. rules: [{
  313. required: true,
  314. message: `${sldComLanguage('请选择结算日')}`,
  315. }],
  316. item_height: 140,
  317. };
  318. async componentDidMount() {
  319. this.props.dispatch({
  320. type: 'global/getLayoutCollapsed',
  321. });
  322. const { query } = this.state;
  323. this.get_detail({ storeId: query.id });
  324. }
  325. //获取开店时长列表
  326. getStoreOpenTime = (webSite) => {
  327. return new Promise((resolve) => {
  328. let { openTimeList } = this.state;
  329. const { dispatch } = this.props;
  330. dispatch({
  331. type: 'store/get_store_open_time',
  332. payload: {webSite},
  333. callback: (res) => {
  334. if (res.state == 200) {
  335. let tmp_data = [];
  336. res.data.map(item => {
  337. tmp_data.push({ key: item, name: item + '年' });
  338. });
  339. openTimeList[webSite] = tmp_data;
  340. this.setState({
  341. openTimeList,
  342. }, () => resolve());
  343. }
  344. },
  345. });
  346. })
  347. };
  348. switchBillType = (e) => {
  349. let { settle_info,store_detail } = this.state;
  350. settle_info = settle_info.filter(item => item.name != 'billDays');
  351. let tar_bill_data = {};
  352. if (e == 1) {
  353. //按月结算
  354. tar_bill_data = JSON.parse(JSON.stringify(this.month_data));
  355. } else if (e == 2) {
  356. //按周结算
  357. tar_bill_data = JSON.parse(JSON.stringify(this.week_data));
  358. }
  359. if(store_detail.billType == e){
  360. tar_bill_data.initialValue = store_detail.billDay != null && store_detail.billDay ? store_detail.billDay.split(',') : '';
  361. }
  362. settle_info.push(tar_bill_data);
  363. this.setState({ settle_info });
  364. };
  365. //获取地址信息
  366. getAreaInfo = (area) => {
  367. this.sel_area_name = ''
  368. for (let i in area) {
  369. this.sel_area_name += area[i].regionName;
  370. }
  371. };
  372. //获取店铺等级
  373. get_store_grade = (webSite) => {
  374. return new Promise((resolve) => {
  375. let { storeGradeIdList } = this.state;
  376. const { dispatch } = this.props;
  377. dispatch({
  378. type: 'store/get_grade_lists',
  379. payload: { pageSize: list_com_page_more, webSite },
  380. callback: (res) => {
  381. if (res.state == 200) {
  382. storeGradeIdList[webSite] = res.data.list
  383. this.setState({
  384. storeGradeIdList,
  385. }, () => resolve());
  386. }
  387. },
  388. });
  389. })
  390. };
  391. getInitData = async (siteList) => {
  392. const promiseList = [];
  393. siteList.forEach(site => {
  394. promiseList.push(this.get_store_grade(site.webSite));
  395. promiseList.push(this.getStoreOpenTime(site.webSite))
  396. })
  397. await Promise.all(promiseList)
  398. }
  399. get_detail = (params) => {
  400. const { dispatch } = this.props;
  401. let { store_detail, store_base_info, personal_front_card_img, store_business_info, replenish_img, business_license_img, settle_info } = this.state;
  402. dispatch({
  403. type: 'store/get_settled_store_apply_detail',
  404. payload: params,
  405. callback: async res => {
  406. if (res.state == 200) {
  407. store_detail = res.data;
  408. for (let i = 0; i < store_base_info.length; i++) {
  409. if (store_detail.enterType == 1 && store_base_info[i].name == 'enterTypeValue') {
  410. store_base_info.splice(i + 1, 0, {
  411. type: 'input',
  412. maxLength: 20,
  413. label: `${sldComLanguage('公司名称')}`,
  414. name: 'companyName',
  415. placeholder: `${sldComLanguage('请输入公司名称,最多20个字')}`,
  416. initialValue: '',
  417. required: true,
  418. rules: [{
  419. required: true,
  420. message: `${sldComLanguage('请输入公司名称')}`,
  421. }],
  422. });
  423. }
  424. if (store_base_info[i].name == 'enterTypeValue') {
  425. store_base_info[i].text = store_detail[store_base_info[i].name];
  426. } else if (store_base_info[i].name == 'area') {
  427. store_base_info[i].initialValue = [store_detail.companyProvinceCode, store_detail.companyCityCode, store_detail.companyAreaCode];
  428. this.sel_area_name = store_detail.areaInfo;
  429. } else {
  430. store_base_info[i].initialValue = store_detail[store_base_info[i].name];
  431. }
  432. }
  433. if (store_detail.enterType == 1) {
  434. //补充认证1图片
  435. if (store_detail.moreQualification1) {
  436. replenish_img[0].fileList.push({
  437. response: {
  438. data: {
  439. path: store_detail.moreQualification1,
  440. url: store_detail.moreQualification1Path,
  441. },
  442. },
  443. name: store_detail.moreQualification1,
  444. uid: store_detail.moreQualification1,
  445. status: 'done',
  446. thumbUrl: store_detail.moreQualification1Path,
  447. });
  448. }
  449. //补充认证2图片
  450. if (store_detail.moreQualification2) {
  451. replenish_img[1].fileList.push({
  452. response: {
  453. data: {
  454. path: store_detail.moreQualification2,
  455. url: store_detail.moreQualification2Path,
  456. },
  457. },
  458. name: store_detail.moreQualification2,
  459. uid: store_detail.moreQualification2,
  460. status: 'done',
  461. thumbUrl: store_detail.moreQualification2Path,
  462. });
  463. }
  464. //补充认证3图片
  465. if (store_detail.moreQualification3) {
  466. replenish_img[2].fileList.push({
  467. response: {
  468. data: {
  469. path: store_detail.moreQualification3,
  470. url: store_detail.moreQualification3Path,
  471. },
  472. },
  473. name: store_detail.moreQualification3,
  474. uid: store_detail.moreQualification3,
  475. status: 'done',
  476. thumbUrl: store_detail.moreQualification3Path,
  477. });
  478. }
  479. }
  480. //身份证正面图片
  481. personal_front_card_img[0].fileList.push({
  482. response: {
  483. data: {
  484. path: store_detail.personCardUp,
  485. url: store_detail.personCardUpPath,
  486. },
  487. },
  488. name: store_detail.personCardUp,
  489. uid: store_detail.personCardUp,
  490. status: 'done',
  491. thumbUrl: store_detail.personCardUpPath,
  492. });
  493. //身份证反面图片
  494. personal_front_card_img[1].fileList.push({
  495. response: {
  496. data: {
  497. path: store_detail.personCardDown,
  498. url: store_detail.personCardDownPath,
  499. },
  500. },
  501. name: store_detail.personCardDown,
  502. uid: store_detail.personCardDown,
  503. status: 'done',
  504. thumbUrl: store_detail.personCardDownPath,
  505. });
  506. //营业执照信息-start
  507. business_license_img[0].fileList.push({
  508. response: {
  509. data: {
  510. path: store_detail.businessLicenseImage,
  511. url: store_detail.businessLicenseImagePath,
  512. },
  513. },
  514. name: store_detail.businessLicenseImage,
  515. uid: store_detail.businessLicenseImage,
  516. status: 'done',
  517. thumbUrl: store_detail.businessLicenseImagePath,
  518. });
  519. //营业执照信息-end
  520. //店铺经营信息-start
  521. // store_business_info.map(item => {
  522. // if (item.name == 'storeName') {
  523. // item.text = store_detail[item.name];
  524. // } else if (item.name == 'billCycle') {
  525. // item.initialValue = 1;
  526. // } else {
  527. // item.initialValue = store_detail[item.name];
  528. // }
  529. // });
  530. //店铺经营信息-end
  531. //结算信息-start
  532. for (let bill_i = 0; bill_i < settle_info.length; bill_i++) {
  533. if (settle_info[bill_i].name == 'billCycle') {
  534. settle_info[bill_i].initialValue = store_detail.billType ? store_detail.billType : 1;
  535. let temp_data = {};
  536. if (settle_info[bill_i].initialValue == 1) {
  537. temp_data = JSON.parse(JSON.stringify(this.month_data));
  538. } else {
  539. temp_data = JSON.parse(JSON.stringify(this.week_data));
  540. }
  541. settle_info.push(temp_data);
  542. } else {
  543. settle_info[bill_i].initialValue = store_detail.billDay ? store_detail.billDay.split(',') : [];
  544. }
  545. }
  546. //结算信息-end
  547. const { storeGoodsCateVOList, storeBusinessVOList } = store_detail;
  548. const siteListData = [];
  549. storeGoodsCateVOList?.forEach(item => {
  550. if (!siteListData.find(site => site.webSite === item.webSite)) {
  551. siteListData.push({
  552. webSite: item.webSite,
  553. webSiteName: item.webSiteName
  554. })
  555. }
  556. });
  557. if (siteListData.length) {
  558. await this.getInitData(siteListData)
  559. siteListData.forEach(item => {
  560. const matchItem = storeBusinessVOList.find(vo => vo.webSite === item.webSite);
  561. if (matchItem) {
  562. item.store_business_info = store_business_info.map(info => ({
  563. ...info,
  564. name: `${info.name}_${matchItem.webSite}`,
  565. text: matchItem[info.name] ?? '',
  566. initialValue: matchItem[info.name]
  567. })).map((tag) => this.parseSiteItem(tag, item.webSite))
  568. }
  569. })
  570. const sortSiteList = siteListData.sort((a, b) => Number(a.webSite) - Number(b.webSite));
  571. this.setState({siteList: sortSiteList});
  572. this.setState({currentSite: siteListData[0]})
  573. }
  574. this.setState({
  575. store_base_info,
  576. store_detail,
  577. // store_business_info,
  578. replenish_img,
  579. business_license_img,
  580. personal_front_card_img,
  581. settle_info,
  582. show_radio_flag: true,
  583. });
  584. } else {
  585. failTip(res.msg);
  586. }
  587. },
  588. });
  589. };
  590. parseSiteItem = (item, webSite) => {
  591. const { storeGradeIdList, openTimeList} = this.state;
  592. if (item.name == 'billCycle') {
  593. item.initialValue = 1;
  594. }
  595. if (item.name.includes('storeGradeId')) {
  596. item.sel_data = storeGradeIdList[webSite]
  597. }
  598. if (item.name.includes('openTime')) {
  599. item.sel_data = openTimeList[webSite]
  600. }
  601. return item;
  602. }
  603. //表格编辑事件
  604. handleFieldChange(val, fieldName, record) {
  605. let { store_detail } = this.state;
  606. let tar_data = store_detail.storeGoodsCateVOList.filter(item => item.bindId == record.bindId);
  607. if (tar_data.length > 0) {
  608. tar_data[0][fieldName] = val;
  609. this.setState({ store_detail }, () => {
  610. sthis.props.form.resetFields(['scaling' + record.bindId]);
  611. });
  612. }
  613. }
  614. //预览图片
  615. uploadImgPre = (img) => {
  616. this.viewImg(true, img.url || img.thumbUrl);
  617. };
  618. //预览图片/关闭预览图片
  619. viewImg = (flag, img = '', text = '') => {
  620. this.setState({
  621. preview_img: img,
  622. preview_alt_con: text,
  623. show_preview_modal: flag,
  624. });
  625. };
  626. //上传图片 key name ,info
  627. uploadImg = (key, name, info) => {
  628. let tmp_data = this.state[key];
  629. if (info.file.status != undefined && info.file.status != 'error') {
  630. for (let i in tmp_data) {
  631. if (tmp_data[i].name == name) {
  632. tmp_data[i].fileList = info.fileList;
  633. break;
  634. }
  635. }
  636. this.setState({ [key]: tmp_data });
  637. }
  638. };
  639. //保存
  640. save = () => {
  641. let { query, currentSite, siteList, store_detail, business_license_img, replenish_img, personal_front_card_img } = this.state;
  642. this.props.form.validateFieldsAndScroll((err, values) => {
  643. if(!err){
  644. let params = { ...values };
  645. params.storeId = query.id;
  646. params.areaInfo = this.sel_area_name;
  647. params.billType = values.billCycle;
  648. // params.billDays = values.billDays.join(',');
  649. delete params.billCycle;
  650. params.companyProvinceCode = values.area[0];
  651. params.companyCityCode = values.area[1];
  652. params.companyAreaCode = values.area[2];
  653. delete params.area;
  654. if (store_detail.enterType == 1) {
  655. //企业入驻
  656. if (business_license_img[0].fileList.length == 0) {
  657. failTip(`${sldComLanguage('请上传营业执照图片')}`);
  658. return false;
  659. } else {
  660. params.businessLicenseImage = business_license_img[0].fileList[0].response.data.path;//营业执照图片
  661. }
  662. if (replenish_img[0].fileList.length > 0) {
  663. params.moreQualification1 = replenish_img[0].fileList[0].response.data.path;//补充认证一图片
  664. }
  665. if (replenish_img[1].fileList.length > 0) {
  666. params.moreQualification2 = replenish_img[1].fileList[0].response.data.path;//补充认证二图片
  667. }
  668. if (replenish_img[2].fileList.length > 0) {
  669. params.moreQualification3 = replenish_img[2].fileList[0].response.data.path;//补充认证三图片
  670. }
  671. }
  672. if (personal_front_card_img[0].fileList.length == 0) {
  673. failTip(`${sldComLanguage('请上传身份证正面图片')}`);
  674. return false;
  675. } else {
  676. params.personCardUp = personal_front_card_img[0].fileList[0].response.data.path;//身份证正面图片
  677. }
  678. if (personal_front_card_img[1].fileList.length == 0) {
  679. failTip(`${sldComLanguage('请上传身份证反面图片')}`);
  680. return false;
  681. } else {
  682. params.personCardDown = personal_front_card_img[1].fileList[0].response.data.path;//身份证反面图片
  683. }
  684. // 处理店铺等级以及开店时长
  685. params.storeBusinessVOList = store_detail.storeBusinessVOList.map(item => ({
  686. storeGradeId: values[`storeGradeId_${item.webSite}`],
  687. // storeGradeName: '5颗星',
  688. openTime: values[`openTime_${item.webSite}`],
  689. webSite: item.webSite,
  690. // storeName: item.storeName,
  691. }))
  692. siteList.forEach(site => {
  693. delete params[`storeGradeId_${site.webSite}`];
  694. delete params[`openTime_${site.webSite}`]
  695. })
  696. this.props.dispatch({
  697. type: 'store/edit_settled_store_info',
  698. payload: params,
  699. callback: res => {
  700. if (res.state == 200) {
  701. this.props.dispatch({
  702. type: 'share/updateDate',
  703. payload: { flag: true, type: 'edit_settle_store_info', sldGlobalShareData: {} }
  704. });
  705. sucTip(res.msg, 1);
  706. //提示并返回上级页面
  707. setTimeout(() => {
  708. sthis.props.history.goBack();
  709. }, 500);
  710. } else {
  711. failTip(res.msg);
  712. }
  713. },
  714. });
  715. } else {
  716. const errorKeys = Object.keys(err);
  717. const firstKeyBelongSite = errorKeys[0].replace(/^[^_]*_/, "");
  718. const matchSite = siteList.find(site => site.webSite === firstKeyBelongSite);
  719. if ( matchSite && firstKeyBelongSite !== currentSite.webSite) {
  720. this.setCurrentSite({
  721. webSite: firstKeyBelongSite,
  722. webSiteName: matchSite.webSiteName
  723. })
  724. }
  725. }
  726. });
  727. };
  728. // 切换站点
  729. setCurrentSite = (site) => {
  730. this.setState({ currentSite: site })
  731. }
  732. render() {
  733. const {
  734. siteList, currentSite, store_base_info, personal_front_card_img, store_business_info, columns, store_detail, business_license_img, replenish_img, show_radio_flag, settle_info, preview_img, show_preview_modal, preview_alt_con,
  735. } = this.state;
  736. return (
  737. <div className={global.common_page}
  738. style={{ flex: 1, flexDirection: 'column', overflow: 'hidden' }}>
  739. <div className={global.flex_com_space_between} style={{ margin: 10, marginTop: 0 }}>
  740. {sldLlineRtextAddGoods(defaultSettings.primaryColor, `${sldComLanguage('编辑店铺信息')}`)}
  741. {sldIconBtnBg(() => router.go(-1), 'fanhui', `${sldComLanguage('返回上级页面')}`, '#fff', 7, 0, 15, 15, 5)}
  742. </div>
  743. {getSldHorLine(1)}
  744. <Scrollbars
  745. autoHeight
  746. autoHeightMin={100}
  747. autoHeightMax={document.body.clientHeight - 170}
  748. >
  749. {sldCommonTitle(`${store_detail.enterType == 1 ? `${sldComLanguage('公司联系人信息')}` : `${sldComLanguage('店铺信息')}`}`, '#333', 5, 15, 15)}
  750. <SldTableRowTwo r_color={'#333'} l_color={'#999'} l_fontw={500} r_fontw={600} form={this.props.form}
  751. data={store_base_info}/>
  752. {store_detail.enterType == 1 &&
  753. <Fragment>
  754. {sldCommonTitle(`${sldComLanguage('营业执照信息')}`, '#333', 5, 15, 15)}
  755. <SldTableRowTwo r_color={'#333'} l_color={'#999'} l_fontw={500} r_fontw={600} form={this.props.form}
  756. part_width={100} lwidth={10} rwidth={90}
  757. data={business_license_img}/>
  758. </Fragment>
  759. }
  760. {sldCommonTitle(`${store_detail.enterType == 1 ? `${sldComLanguage('法人身份信息')}` : `${sldComLanguage('身份证信息')}`}`, '#333', 5, 15, 15)}
  761. <SldTableRowTwo r_color={'#333'} l_color={'#999'} l_fontw={500} r_fontw={600} form={this.props.form}
  762. part_width={100} lwidth={10} rwidth={90}
  763. data={personal_front_card_img}/>
  764. {store_detail.enterType == 1 &&
  765. <Fragment>
  766. {sldCommonTitle(`${sldComLanguage('补充认证信息')}`, '#333', 5, 15, 15)}
  767. <SldTableRowTwo r_color={'#333'} l_color={'#999'} l_fontw={500} r_fontw={600} form={this.props.form}
  768. part_width={100} lwidth={10} rwidth={90}
  769. data={replenish_img}/>
  770. </Fragment>
  771. }
  772. <div className={global.site_list}>
  773. {siteList.map((site) => (
  774. <div
  775. key={site.webSite}
  776. onClick={() => this.setCurrentSite(site)}
  777. className={`${global.site_item} ${site.webSite === currentSite.webSite ? global.site_active : ''}`}
  778. >
  779. {site.webSiteName}
  780. </div>
  781. ))}
  782. </div>
  783. <div className={global.site_info_list}>
  784. {sldCommonTitle(`${sldComLanguage('店铺经营信息')}`, '#333', 5, 15, 15)}
  785. {siteList.map((site) => (
  786. <div
  787. key={site.webSite}
  788. className={`${global.site_info_item} ${site.webSite === currentSite.webSite ? global.site_info_active : ''}`}
  789. >
  790. {show_radio_flag && <SldTableRowTwo
  791. r_color={'#333'}
  792. l_color={'#999'}
  793. l_fontw={500}
  794. r_fontw={600}
  795. form={this.props.form}
  796. data={site.store_business_info}
  797. />}
  798. </div>
  799. ))}
  800. </div>
  801. {/*{show_radio_flag &&*/}
  802. {/*<Fragment>*/}
  803. {/* {sldCommonTitle(`${sldComLanguage('店铺结算信息')}`, '#333', 5, 15, 15)}*/}
  804. {/* <SldTableRowTwo r_color={'#333'} l_color={'#999'} l_fontw={500} r_fontw={600} form={this.props.form}*/}
  805. {/* part_width={100} lwidth={10} rwidth={90}*/}
  806. {/* data={settle_info}/>*/}
  807. {/*</Fragment>*/}
  808. {/*}*/}
  809. {sldCommonTitle(`${sldComLanguage('经营类目')}`, '#333', 5, 15, 15)}
  810. <div style={{ width: '98%', maxHeight: 300 }}>
  811. <Scrollbars autoHeight
  812. autoHeightMax={300}>
  813. <Table rowKey={'bindId'} pagination={false} columns={columns}
  814. dataSource={store_detail.storeGoodsCateVOList?.filter(item => item.webSite === currentSite.webSite)} size={'small'}/>
  815. </Scrollbars>
  816. </div>
  817. {getSldEmptyH(10)}
  818. </Scrollbars>
  819. {/*图片预览-start*/}
  820. <SldPreviewImg img={preview_img} show_preview_modal={show_preview_modal} modal_width={500}
  821. preview_alt_con={preview_alt_con} closePreviewModal={() => this.viewImg(false)}/>
  822. {/*图片预览-end*/}
  823. <div className={global.m_diy_bottom_wrap}
  824. style={{ position: 'fixed', left: this.props.global.collapsed ? 90 : 160 }}>
  825. <div onClick={() => router.go(-1)} className={global.add_goods_bottom_btn}>
  826. {sldComLanguage('返回')}
  827. </div>
  828. <div onClick={() => this.save()}
  829. className={`${global.add_goods_bottom_btn} ${global.add_goods_bottom_btn_sel}`}>
  830. {sldComLanguage('保存')}
  831. </div>
  832. </div>
  833. </div>
  834. );
  835. }
  836. }