index.js 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301
  1. import React, { PureComponent } from "react";
  2. import { connect } from "dva";
  3. import {
  4. Menu,
  5. Icon,
  6. Pagination,
  7. Table,
  8. Radio,
  9. Tabs,
  10. Row,
  11. Col,
  12. Card,
  13. Checkbox,
  14. message,
  15. Select
  16. } from "antd";
  17. import styles from "./index.less";
  18. import imgSrc from "./goods-img.png";
  19. import GoodsBuyIpt from "../GoodsBuyIpt/index.js";
  20. import EmptyData from "@/components/EmptyData/index";
  21. import GridTable from "../GridTable/index";
  22. import GoodsOptsDialog from "@/components/GoodsOptsDialog/index";
  23. import { translateItemBomFromItem } from "@/pages/Buyer/orderEdit/orderTools";
  24. import { goodsVersion, amountPrecision, unitPrecision } from '@/utils/common';
  25. const RadioGroup = Radio.Group;
  26. const TabPane = Tabs.TabPane;
  27. const Option = Select.Option;
  28. class OrderGoodsList extends PureComponent {
  29. constructor(props) {
  30. super(props);
  31. this.state = {
  32. goodsOptsParam: {
  33. rowData: {}
  34. },
  35. selectedGiftProms: [], // 选中的赠品行
  36. selectedGoodsValues: [], // 选中复选框项
  37. selectedPromStyle: "" // 选择促销
  38. };
  39. const { ifEditable } = this.props;
  40. this.columns = [
  41. {
  42. title: "商品",
  43. dataIndex: "goodsId",
  44. key: "goodsId",
  45. width: "280px",
  46. render: (text, record, index) => (
  47. <div className={styles.goodsNameBox}>
  48. <div style={{"float": 'left', "fontSize": "1.5rem", "paddingRight": "1rem"}}>
  49. {Number(index) + 1}
  50. </div>
  51. <div className={styles.imgBox}>
  52. <img src={record.goodsImg} alt="" />
  53. </div>
  54. <div className={styles.goodsInfo}>
  55. <p className={styles.goodsTitleName} title={record.goodsDisplayName}>
  56. {record.goodsDisplayName}
  57. </p>
  58. <p className={styles.goodsCode}>
  59. <span>编码:{record.goodsCode}</span>
  60. <span style={{'marginLeft':'20px'}}>规格:{record.specification}</span>
  61. </p>
  62. <p className={styles.goodsCode}>
  63. <span>型号:{record.model}</span>
  64. </p>
  65. <p className={record.isGift == 1 ? styles.goodsStatus : ""}>
  66. <span className={styles.goodsStatusTxt}>
  67. {record.isGift == 1 ? "赠" : ""}
  68. </span>
  69. </p>
  70. </div>
  71. </div>
  72. )
  73. },
  74. {
  75. title: "商品选配",
  76. dataIndex: "baseGoodsOptValue",
  77. key: "baseGoodsOptValue",
  78. align: "right",
  79. render: (text, record, index) => {
  80. if (record.isOptional || record.baseGoodsOptValue) {
  81. return (
  82. <span className={styles.goodsOpt} onClick={this.onGoodsOptionalHandle.bind(this, record, index)}>
  83. {record.baseGoodsOptValue || "添加选配"}
  84. </span>
  85. );
  86. } else {
  87. return null;
  88. }
  89. }
  90. },
  91. {
  92. title: "单价",
  93. dataIndex: "salePrice",
  94. key: "salePrice",
  95. className: "alignRight",
  96. render: (text, record, index) => (
  97. <span>
  98. <span className={`${styles.fontRed} ${styles.textBox}`}>
  99. {amountPrecision(record.salePrice, "price", record.currencySign, 2)}
  100. </span>
  101. <em className={`${styles.em} ${styles.unitBox}`}>
  102. /{record.mainNumUnitName}
  103. </em>
  104. </span>
  105. )
  106. },
  107. {
  108. title: "成交价",
  109. dataIndex: "dealPrice",
  110. key: "dealPrice",
  111. className: "alignRight",
  112. render: (text, record, index) => (
  113. <span>
  114. <span className={`${styles.fontRed} ${styles.textBox}`}>
  115. {amountPrecision(record.dealPrice, "price", record.currencySign, 2)}
  116. </span>
  117. <em className={`${styles.em} ${styles.unitBox}`}>
  118. /{record.mainNumUnitName}
  119. </em>
  120. </span>
  121. )
  122. },
  123. // {
  124. // title: "库存量",
  125. // dataIndex: "stock",
  126. // key: "stock",
  127. // className: "alignRight",
  128. // render: (text, record, index) => (
  129. // <span className={styles.MainNum}>
  130. // <span className={styles.textBox}>{record.stock}</span>
  131. // <em className={`${styles.em} ${styles.unitBox}`}>
  132. // {record.mainNumUnitName}
  133. // </em>
  134. // </span>
  135. // )
  136. // },
  137. {
  138. title: "订货量",
  139. dataIndex: "orderNum",
  140. key: "orderNum",
  141. className: ifEditable ? "thAlignCenter" : "alignRight",
  142. render: (text, record, index) => {
  143. if (!ifEditable) {
  144. return (
  145. <span className={styles.orderNum}>
  146. <span className={styles.textBox}>{record.orderNum}</span>
  147. <em className={`${styles.em} ${styles.unitBox}`}>
  148. {record.orderNumUnitName}
  149. </em>
  150. </span>
  151. );
  152. } else {
  153. return (
  154. <div className={styles.numIptBox} style={{ marginLeft: "20px" }}>
  155. <div style={{ width: "100px", display: "inline-block" }}>
  156. <GoodsBuyIpt
  157. key={record.goodsId + "-"+ index}
  158. num={record.orderNum}
  159. onChange={this.buyNumChange.bind(this, index)}
  160. />
  161. </div>
  162. <em className={styles.em} style={{ paddingLeft: "1px" }}>
  163. {record.orderNumUnitName}
  164. </em>
  165. </div>
  166. );
  167. }
  168. }
  169. },
  170. // {
  171. // title: "主数量",
  172. // dataIndex: "mainNum",
  173. // key: "mainNum",
  174. // className: "alignRight",
  175. // render: (text, record, index) => (
  176. // <span className={styles.MainNum}>
  177. // <span className={styles.textBox}>{record.mainNum}</span>
  178. // <em className={`${styles.em} ${styles.unitBox}`}>
  179. // {record.mainNumUnitName}
  180. // </em>
  181. // </span>
  182. // )
  183. // },
  184. {
  185. title: "重量",
  186. dataIndex: "rowWeight",
  187. key: "rowWeight",
  188. className: "alignRight",
  189. render: (text, record, index) => (
  190. <span className={styles.MainNum}>
  191. <span className={styles.textBox}>{(text || 0).toFixed(2)}</span>
  192. <em className={`${styles.em} ${styles.unitBox}`}>{record.weightUnitName || ""}</em>
  193. </span>
  194. )
  195. },
  196. // {
  197. // title: "体积",
  198. // dataIndex: "rowVolume",
  199. // key: "rowVolume",
  200. // className: "alignRight",
  201. // render: (text, record, index) => (
  202. // <span className={styles.MainNum}>
  203. // <span className={styles.textBox}>{(text || 0).toFixed(record.volumeUnitPrecision || 2)}</span>
  204. // <em className={`${styles.em} ${styles.unitBox}`}>{record.volumeUnitName || ""}</em>
  205. // </span>
  206. // )
  207. // },
  208. {
  209. title: "金额",
  210. dataIndex: "amount",
  211. key: "amount",
  212. width: "100px",
  213. className: "alignRight",
  214. render: (text, record, index) => (
  215. <span className={styles.MainNum}>
  216. {amountPrecision(record.amount, "amount", record.currencySign, 2)}
  217. </span>
  218. )
  219. },
  220. {
  221. title: "成交金额",
  222. dataIndex: "dealAmount",
  223. key: "dealAmount",
  224. width: "100px",
  225. className: "alignRight",
  226. render: (text, record, index) => (
  227. <div className={styles.dealAmount}>
  228. <span className={styles.fontRed}>
  229. {amountPrecision(record.dealAmount, "amount", record.currencySign, 2)}
  230. </span>
  231. </div>
  232. )
  233. },
  234. // {
  235. // title: "项目",
  236. // dataIndex: "projectId",
  237. // key: "projectId",
  238. // className: "thAlignCenter",
  239. // render: (text, record, index) => (
  240. // <Select
  241. // style={{ width: "100px", height: "30px", marginLeft: "10px" }}
  242. // key={`projectId${index}${record.goodsId}`}
  243. // value={text}
  244. // onChange={this.recordValueChange.bind(
  245. // this,
  246. // index,
  247. // "projectId"
  248. // )}
  249. // >
  250. // {record.projectData.map(item => (
  251. // <Option
  252. // key={`projectId${index}${record.goodsId}${item.id}`}
  253. // value={item.id}
  254. // >
  255. // {item.name}
  256. // </Option>
  257. // ))}
  258. // </Select>
  259. // )
  260. // },
  261. {
  262. title: "",
  263. dataIndex: "operation",
  264. key: "operation",
  265. width: "20px",
  266. render: (text, record, index) => {
  267. if (ifEditable) {
  268. return (
  269. <div className={styles.delBtn}>
  270. <Icon
  271. type="close-circle"
  272. className={styles.delIcon}
  273. onClick={this.delHandle.bind(this, record)}
  274. />
  275. </div>
  276. );
  277. }
  278. }
  279. }
  280. ];
  281. this.bomColumns = [
  282. {
  283. title: "商品",
  284. dataIndex: "goodsId",
  285. key: "goodsId-bom",
  286. width: "25%",
  287. render: (text, record, index) => (
  288. <div className={styles.goodsNameBox}>
  289. <div className={styles.imgBox}>
  290. <img src={record.goodsImg} alt="" />
  291. </div>
  292. <div className={styles.goodsInfo}>
  293. <p className={styles.goodsTitleName} title={record.goodsDisplayName || record.goodsName}>
  294. {record.goodsDisplayName}
  295. </p>
  296. <p className={styles.goodsCode}>{record.goodsCode}{goodsVersion(record.version)}</p>
  297. <p className={record.isGift == 1 ? styles.goodsStatus : ""}>
  298. <span className={styles.goodsStatusTxt}>
  299. {record.isGift == 1 ? "赠" : ""}
  300. </span>
  301. </p>
  302. </div>
  303. </div>
  304. )
  305. },
  306. {
  307. title: "选配",
  308. dataIndex: "baseGoodsOptValue",
  309. key: "baseGoodsOptValue-bom",
  310. width: "15%",
  311. render: (text, record, index) => (
  312. <span className={styles.valBox} title={record.baseGoodsOptValue}>
  313. {record.baseGoodsOptValue}
  314. </span>
  315. )
  316. },
  317. {
  318. title: "母件行号",
  319. dataIndex: "parentRowNum",
  320. key: "parentRowNum",
  321. width: "10%",
  322. className: "alignRight",
  323. render: (text, record, index) => (
  324. <span>
  325. <span>{text}</span>
  326. </span>
  327. )
  328. },
  329. {
  330. title: "母件商品名称",
  331. dataIndex: "parentGoodsName",
  332. key: "parentGoodsName",
  333. width: "12%",
  334. className: "alignRight",
  335. render: (text, record, index) => (
  336. <span className={styles.valBox} title={text}>
  337. {text}
  338. </span>
  339. )
  340. },
  341. {
  342. title: "母件商品编码",
  343. dataIndex: "parentGoodsCode",
  344. key: "parentGoodsCode",
  345. width: "12%",
  346. className: "alignRight",
  347. render: (text, record, index) => (
  348. <span className={styles.valBox} title={text}>
  349. {text}
  350. </span>
  351. )
  352. },
  353. // {
  354. // title: "重量",
  355. // dataIndex: "rowWeight",
  356. // key: "rowWeight-bom",
  357. // className: "alignRight",
  358. // render: (text, record, index) => (
  359. // <span className={styles.MainNum}>
  360. // <span className={styles.textBox}>{(text || 0).toFixed(record.weightUnitPrecision || 2)}</span>
  361. // <em className={`${styles.em} ${styles.unitBox}`}>{record.weightUnitName || ""}</em>
  362. // </span>
  363. // )
  364. // },
  365. // {
  366. // title: "单价",
  367. // dataIndex: "salePrice",
  368. // key: "salePrice-bom",
  369. // className: "alignRight",
  370. // render: (text, record, index) => (
  371. // <span>
  372. // <span className={`${styles.fontRed} ${styles.textBox}`}>
  373. // {amountPrecision(record.salePrice, "price", record.currencySign, record.currencyPriceScale)}
  374. // </span>
  375. // <em className={`${styles.em} ${styles.unitBox}`}>
  376. // /{record.mainNumUnitName}
  377. // </em>
  378. // </span>
  379. // )
  380. // },
  381. // {
  382. // title: "成交价",
  383. // dataIndex: "dealPrice",
  384. // key: "dealPrice-bom",
  385. // className: "alignRight",
  386. // render: (text, record, index) => (
  387. // <span>
  388. // <span className={`${styles.fontRed} ${styles.textBox}`}>
  389. // {amountPrecision(record.dealPrice, "price", record.currencySign, record.currencyPriceScale)}
  390. // </span>
  391. // <em className={`${styles.em} ${styles.unitBox}`}>
  392. // /{record.mainNumUnitName}
  393. // </em>
  394. // </span>
  395. // )
  396. // },
  397. {
  398. title: "订货量",
  399. dataIndex: "orderNum",
  400. key: "orderNum-bom",
  401. width: "12%",
  402. className: "alignRight",
  403. render: (text, record, index) => (
  404. <span className={styles.orderNum}>
  405. <span className={styles.textBox}>{record.orderNum}</span>
  406. <em className={`${styles.em} ${styles.unitBox}`}>
  407. {record.orderNumUnitName}
  408. </em>
  409. </span>
  410. )
  411. },
  412. {
  413. title: "主数量",
  414. dataIndex: "mainNum",
  415. key: "mainNum-bom",
  416. width: "12%",
  417. className: "alignRight",
  418. render: (text, record, index) => (
  419. <span className={styles.MainNum}>
  420. <span className={styles.textBox}>{record.mainNum}</span>
  421. <em className={`${styles.em} ${styles.unitBox}`}>
  422. {record.mainNumUnitName}
  423. </em>
  424. </span>
  425. )
  426. },
  427. // {
  428. // title: "重量",
  429. // dataIndex: "rowWeight",
  430. // key: "rowWeight-bom",
  431. // className: "alignRight",
  432. // render: (text, record, index) => (
  433. // <span className={styles.MainNum}>
  434. // <span className={styles.textBox}>{(text || 0).toFixed(record.weightUnitPrecision || 2)}</span>
  435. // <em className={`${styles.em} ${styles.unitBox}`}>{record.weightUnitName || ""}</em>
  436. // </span>
  437. // )
  438. // },
  439. // {
  440. // title: "体积",
  441. // dataIndex: "rowVolume",
  442. // key: "rowVolume-bom",
  443. // className: "alignRight",
  444. // render: (text, record, index) => (
  445. // <span className={styles.MainNum}>
  446. // <span className={styles.textBox}>{(text || 0).toFixed(record.volumeUnitPrecision || 2)}</span>
  447. // <em className={`${styles.em} ${styles.unitBox}`}>{record.volumeUnitName || ""}</em>
  448. // </span>
  449. // )
  450. // },
  451. // {
  452. // title: "金额",
  453. // dataIndex: "amount",
  454. // key: "amount-bom",
  455. // width: "100px",
  456. // className: "alignRight",
  457. // render: (text, record, index) => (
  458. // <span className={styles.MainNum}>
  459. // {amountPrecision(record.amount, "amount", record.currencySign, record.currencyAmountScale)}
  460. // </span>
  461. // )
  462. // },
  463. // {
  464. // title: "成交金额",
  465. // dataIndex: "dealAmount",
  466. // key: "dealAmount-bom",
  467. // width: "100px",
  468. // className: "alignRight",
  469. // render: (text, record, index) => (
  470. // <div className={styles.dealAmount}>
  471. // <span className={styles.fontRed}>
  472. // {amountPrecision(record.dealAmount, "amount", record.currencySign, record.currencyAmountScale)}
  473. // </span>
  474. // </div>
  475. // )
  476. // }
  477. ];
  478. this.giftColumns = [
  479. {
  480. title: "商品",
  481. dataIndex: "goodsId",
  482. key: "goodsId-gift",
  483. width: "70%",
  484. className: "thAlignCenter",
  485. render: (text, record, index) => (
  486. <div>
  487. <div className={styles.giftsImgBox}>
  488. <img src={record.goodsImg} alt="" />
  489. </div>
  490. <div className={styles.giftsInfo}>
  491. <p className={styles.goodsTitleName}>{record.goodsDisplayName}</p>
  492. </div>
  493. </div>
  494. )
  495. },
  496. {
  497. title: "订货量",
  498. dataIndex: "orderNum",
  499. key: "orderNum-gift",
  500. width: "20%",
  501. className: "alignRight",
  502. render: (text, record, index) => {
  503. let step = 1;
  504. if (record.combineType == 1) {
  505. step = (parseFloat(record.goodCombineNum) / parseFloat(record.conversionRate || "1")).toFixed(record.orderNumUnitScale || 0);
  506. }
  507. const disabled = (step == 1 ? false : true);
  508. return (
  509. <div className={styles.numIptBox} style={{ marginLeft: "20px" }}>
  510. <div style={{ width: "100px", display: "inline-block" }}>
  511. <GoodsBuyIpt
  512. key={`${record.id}${record.activityId}${index}`}
  513. disabled={disabled}
  514. num={record.orderNum}
  515. step={step}
  516. onChange={this.giftNumChange.bind(this, record)}
  517. />
  518. </div>
  519. <span>{record.orderNumUnitName}</span>
  520. </div>
  521. );
  522. }
  523. },
  524. {
  525. title: "操作",
  526. dataIndex: "operation",
  527. key: "operation-gift",
  528. width: "10%",
  529. className: "alignRight",
  530. render: (text, record, index) => {
  531. return (
  532. <div className={styles.giftsDelBtn} style={{ marginRight: "20px" }}>
  533. <a onClick={this.delGiftHandle.bind(this, record)}>删除</a>
  534. </div>
  535. );
  536. }
  537. }
  538. ];
  539. }
  540. componentWillReceiveProps(nextProps) {
  541. if ("orderCartData" in nextProps) {
  542. const orderCartData = nextProps.orderCartData;
  543. let totalDealAmount = 0; // 商品促销后总金额
  544. // 封装商品行金额信息
  545. for (let i = 0; i < orderCartData.length; i++) {
  546. if (orderCartData[i].isGift == 1) {
  547. continue;
  548. }
  549. orderCartData[i].mainNum = +(parseFloat(orderCartData[i].mainNum).toFixed(orderCartData[i].mainNumUnitScale || 0));
  550. orderCartData[i].orderNum = +(parseFloat(orderCartData[i].orderNum).toFixed(orderCartData[i].orderNumUnitScale || 0));
  551. // 计算体积、重量
  552. orderCartData[i].rowVolume =
  553. parseFloat(orderCartData[i].volume || "0") *
  554. parseFloat(orderCartData[i].mainNum);
  555. orderCartData[i].rowWeight =
  556. parseFloat(orderCartData[i].weight || "0") *
  557. parseFloat(orderCartData[i].mainNum);
  558. // 计算商品金额:基准价 * 主数量
  559. orderCartData[i].amount =
  560. parseFloat(orderCartData[i].salePrice || "0") *
  561. parseFloat(orderCartData[i].mainNum || "0");
  562. // 计算促销后金额:促销价 * 主数量 - 均摊促销金额(整单降价均摊)
  563. const afterPromAmount =
  564. parseFloat(orderCartData[i].promPrice || "0") *
  565. parseFloat(orderCartData[i].mainNum || "0");
  566. orderCartData[i].dealAmount =
  567. afterPromAmount - parseFloat(orderCartData[i].promAmount || "0");
  568. totalDealAmount +=
  569. afterPromAmount - parseFloat(orderCartData[i].promAmount || "0");
  570. orderCartData[i].ext09 = orderCartData[i].salePrice || "0";
  571. orderCartData[i].ext10 = afterPromAmount - parseFloat(orderCartData[i].promAmount || "0");;
  572. }
  573. // 冲抵费用均摊
  574. const offsetAmount = parseFloat(nextProps.offsetAmount || "0");
  575. if (offsetAmount > 0) {
  576. // 把冲抵费用均摊到商品行
  577. const occupyRate = offsetAmount / totalDealAmount;
  578. let occupyStep = offsetAmount;
  579. for (let j = 0; j < orderCartData.length; j++) {
  580. if (orderCartData[j].isGift == 1) {
  581. continue;
  582. }
  583. if (j == orderCartData.length - 1) {
  584. orderCartData[j].offsetAmount = occupyStep;
  585. orderCartData[j].dealAmount -= occupyStep;
  586. break;
  587. }
  588. const dealAmout =
  589. parseFloat(orderCartData[j].promPrice || "0") *
  590. parseFloat(orderCartData[j].mainNum || "0") -
  591. parseFloat(orderCartData[j].promAmount || "0");
  592. const offsetAmt = +(parseFloat(dealAmout * occupyRate).toFixed(
  593. orderCartData[j].currencyAmountScale
  594. ));
  595. occupyStep -= offsetAmt;
  596. orderCartData[j].offsetAmount = offsetAmt;
  597. orderCartData[j].dealAmount -= offsetAmt;
  598. }
  599. }
  600. // 计算成交价
  601. orderCartData.forEach(item => item.dealPrice = item.dealAmount / item.mainNum);
  602. this.sumFun(orderCartData);
  603. }
  604. if ("promotionInfoData" in nextProps) {
  605. const promotionInfoData = nextProps.promotionInfoData;
  606. if (promotionInfoData) {
  607. // 默认选择的促销维度
  608. const mutualRelationShip = promotionInfoData.mutualRelationShip;
  609. const { selectedPromStyle } = this.state;
  610. this.setState({
  611. selectedPromStyle: selectedPromStyle ? selectedPromStyle : (mutualRelationShip
  612. ? mutualRelationShip[0].join(",")
  613. : "")
  614. });
  615. // 对selectedGiftProms 进行封装,以方便后续赠品的勾选与移除
  616. const giftProms = promotionInfoData.giftProms;
  617. if (giftProms) {
  618. const { selectedGiftProms } = this.state;
  619. const newGiftProms = giftProms.map(giftProm => {
  620. const findGiftProm = selectedGiftProms.find(
  621. item =>
  622. `${item.activityId}${item.ruleId}` ==
  623. `${giftProm.activityId}${giftProm.ruleId}`
  624. );
  625. if (findGiftProm) {
  626. return findGiftProm;
  627. } else {
  628. const newGiftProm = Object.assign({}, giftProm, {
  629. giftDtos: null
  630. });
  631. return newGiftProm;
  632. }
  633. });
  634. this.setState({
  635. selectedGiftProms: newGiftProms
  636. });
  637. }
  638. } else {
  639. this.setState({
  640. selectedPromStyle: "",
  641. selectedGoodsValues: [],
  642. selectedGiftProms: []
  643. });
  644. }
  645. }
  646. }
  647. onGoodsOptionalHandle(goods, index) {
  648. // const goodsOptsParam = {
  649. // rowData: goods,
  650. // goodsId: goods.goodsId,
  651. // baseGoodsOptId: goods.baseGoodsOptId,
  652. // rowIndex: index
  653. // };
  654. // this.setState({
  655. // goodsOptsParam: goodsOptsParam
  656. // }, () => {
  657. // this.props.dispatch({
  658. // type: "global/goodsOptsVisible",
  659. // payload: true
  660. // });
  661. // });
  662. this.props.optClick && this.props.optClick(goods, index)
  663. }
  664. // 选择促销方式
  665. onRadioChangeHandle(e) {
  666. e.preventDefault();
  667. const { dispatch, promotionChange } = this.props;
  668. this.setState({
  669. selectedPromStyle: e.target.value
  670. });
  671. promotionChange(e.target.value);
  672. }
  673. // 勾选赠品
  674. onCheckBoxChange(gift, giftDtos, e) {
  675. let { selectedGiftProms, selectedGoodsValues } = this.state;
  676. // todo...
  677. // 判断勾选的赠品是否固定组合
  678. let isCombine = false;
  679. let combineGifts = [];
  680. const key = `${gift.activityId}${gift.ruleId}`;
  681. const goodsId = gift.goodsId;
  682. const conversionRate = parseFloat(gift.conversionRate || "1");
  683. const goodsAmout = parseFloat(gift.goodsAmout || "0");
  684. let orderNum = parseFloat(goodsAmout / conversionRate);
  685. let mainNum = goodsAmout;
  686. if (gift.combineType == 1) {
  687. const goodCombineNum = gift.goodCombineNum;
  688. orderNum = parseFloat(goodCombineNum / conversionRate);
  689. mainNum = goodCombineNum;
  690. isCombine = true;
  691. combineGifts = giftDtos.filter(item => item.giftId == gift.giftId);
  692. }
  693. gift.orderNum = +(orderNum.toFixed(gift.orderNumUnitScale || 0));
  694. gift.mainNum = mainNum;
  695. gift.rowWeight = mainNum * parseFloat(gift.weight || "0");
  696. gift.rowVolume = mainNum * parseFloat(gift.volume || "0");
  697. // 勾选赠品
  698. if (e.target.checked) {
  699. const validMsg = this.validGiftNum(
  700. gift,
  701. selectedGiftProms,
  702. mainNum
  703. );
  704. if (validMsg) {
  705. message.info(validMsg);
  706. this.sumFun();
  707. return false;
  708. }
  709. selectedGiftProms.forEach(giftProm => {
  710. const tempKey = `${giftProm.activityId}${giftProm.ruleId}`;
  711. if (tempKey == key) {
  712. let selectedgiftDtos = giftProm.giftDtos || [];
  713. if (isCombine) {
  714. combineGifts.forEach(item => {
  715. const goodCombineNum = item.goodCombineNum;
  716. item.orderNum = +(parseFloat(goodCombineNum / conversionRate).toFixed(item.orderNumUnitScale || 0));
  717. item.mainNum = goodCombineNum;
  718. });
  719. selectedgiftDtos = selectedgiftDtos.concat(combineGifts);
  720. } else {
  721. selectedgiftDtos = selectedgiftDtos.concat(gift);
  722. }
  723. giftProm.giftDtos = selectedgiftDtos;
  724. }
  725. return giftProm;
  726. });
  727. if (!selectedGoodsValues.includes(e.target.value)) {
  728. if (isCombine) {
  729. combineGifts.forEach(item => {
  730. const valueKey = `${item.activityId}${item.ruleId}${item.goodsId}${gift.giftId}`;
  731. selectedGoodsValues.push(valueKey);
  732. });
  733. } else {
  734. selectedGoodsValues.push(e.target.value);
  735. }
  736. }
  737. // 取消勾选
  738. } else {
  739. selectedGiftProms = this.removeGiftsData(selectedGiftProms, gift, isCombine);
  740. if (isCombine) {
  741. selectedGoodsValues = selectedGoodsValues.filter(
  742. value => !value.endsWith(gift.giftId)
  743. );
  744. } else {
  745. selectedGoodsValues = selectedGoodsValues.filter(
  746. value => value != e.target.value
  747. );
  748. }
  749. }
  750. this.setState({
  751. selectedGoodsValues: selectedGoodsValues,
  752. selectedGiftProms: selectedGiftProms.concat([])
  753. });
  754. this.props.setGiftItems(selectedGiftProms);
  755. this.sumFun();
  756. }
  757. // 赠品数量修改
  758. giftNumChange(gift, num) {
  759. const { selectedGiftProms } = this.state;
  760. const key = `${gift.activityId}${gift.ruleId}`;
  761. const goodsId = gift.goodsId;
  762. const orderNum = parseFloat(num);
  763. const mainNum = orderNum * (gift.conversionRate || "1");
  764. const validMsg = this.validGiftNum(gift, selectedGiftProms, mainNum);
  765. if (validMsg) {
  766. message.info(validMsg);
  767. this.setState({
  768. selectedGiftProms: selectedGiftProms.concat([])
  769. });
  770. this.sumFun();
  771. return false;
  772. }
  773. let isCombine = false;
  774. if (gift.combineType == 1) {
  775. isCombine = true;
  776. }
  777. selectedGiftProms.forEach(giftProm => {
  778. const tempKey = `${giftProm.activityId}${giftProm.ruleId}`;
  779. if (tempKey == key) {
  780. if (isCombine) {
  781. giftProm.giftDtos.forEach(giftDto => {
  782. if (giftDto.giftId == gift.giftId) {
  783. const mainNum = parseFloat(giftDto.mainNum) + parseFloat(giftDto.goodCombineNum || "0");
  784. const rate = parseFloat(giftDto.conversionRate || "1");
  785. giftDto.orderNum = +(parseFloat(mainNum / rate).toFixed(giftDto.orderNumUnitScale || 0));
  786. giftDto.mainNum = mainNum;
  787. giftDto.rowWeight = mainNum * parseFloat(giftDto.weight || "0");
  788. giftDto.rowVolume = mainNum * parseFloat(giftDto.volume || "0");
  789. }
  790. });
  791. } else {
  792. giftProm.giftDtos.forEach(giftDto => {
  793. if (giftDto.goodsId == goodsId) {
  794. giftDto.orderNum = num;
  795. giftDto.mainNum = mainNum;
  796. giftDto.rowWeight = mainNum * parseFloat(giftDto.weight || "0");
  797. giftDto.rowVolume = mainNum * parseFloat(giftDto.volume || "0");
  798. }
  799. });
  800. }
  801. }
  802. });
  803. this.setState({
  804. selectedGiftProms: selectedGiftProms.concat([])
  805. });
  806. this.props.setGiftItems(selectedGiftProms);
  807. this.sumFun();
  808. }
  809. validGiftNum(gift, selectedGiftProms, num) {
  810. let validMsg = "";
  811. const key = `${gift.activityId}${gift.ruleId}`;
  812. const belongGroupId = gift.belongGroupId;
  813. const goodsId = gift.goodsId;
  814. const conversionRate = parseFloat(gift.conversionRate || "1");
  815. const goodsAmout = gift.goodsAmout;
  816. let totalMainNum = num;
  817. const findGiftProm = selectedGiftProms.find(
  818. giftProm => `${giftProm.activityId}${giftProm.ruleId}` == key
  819. );
  820. if (findGiftProm && findGiftProm.giftDtos) {
  821. findGiftProm.giftDtos.forEach(giftDto => {
  822. if (
  823. giftDto.belongGroupId == belongGroupId &&
  824. giftDto.goodsId != goodsId
  825. ) {
  826. totalMainNum += parseFloat(giftDto.mainNum);
  827. }
  828. });
  829. if (totalMainNum > goodsAmout) {
  830. validMsg += `不能超出【买赠】促销【${findGiftProm.description}】下,【${
  831. gift.belongGroupName
  832. }】的可赠数量${Math.floor(goodsAmout / conversionRate)}`;
  833. }
  834. }
  835. return validMsg;
  836. }
  837. // 封装移除赠品数据的方法
  838. removeGiftsData(selectedGiftProms, gift, isCombine) {
  839. // todo...
  840. const key = `${gift.activityId}${gift.ruleId}`;
  841. const goodsId = gift.goodsId;
  842. selectedGiftProms.forEach(giftProm => {
  843. const tempKey = `${giftProm.activityId}${giftProm.ruleId}`;
  844. if (tempKey == key) {
  845. const giftDtos = giftProm.giftDtos;
  846. let newGiftItems = giftDtos.filter(item => item.goodsId != goodsId);
  847. if (isCombine) {
  848. newGiftItems = giftDtos.filter(item => item.giftId != gift.giftId);
  849. }
  850. giftProm.giftDtos = newGiftItems;
  851. }
  852. return giftProm;
  853. });
  854. return selectedGiftProms.concat([]);
  855. }
  856. // 移除赠品
  857. delGiftHandle(gift) {
  858. const { selectedGiftProms, selectedGoodsValues } = this.state;
  859. // 判断勾选的赠品是否固定组合
  860. let isCombine = false;
  861. if (gift.combineType == 1) {
  862. isCombine = true;
  863. }
  864. const newSelectedGiftActivitys = this.removeGiftsData(
  865. selectedGiftProms,
  866. gift,
  867. isCombine
  868. );
  869. const value = `${gift.activityId}${gift.ruleId}${gift.goodsId}${gift.giftId}`;
  870. let newSelectedGiftValues = selectedGoodsValues.filter(
  871. item => item != value
  872. );
  873. if (isCombine) {
  874. newSelectedGiftValues = selectedGoodsValues.filter(
  875. item => !item.endsWith(gift.giftId)
  876. );
  877. }
  878. this.setState({
  879. selectedGoodsValues: newSelectedGiftValues,
  880. selectedGiftProms: newSelectedGiftActivitys
  881. });
  882. this.props.setGiftItems(newSelectedGiftActivitys);
  883. this.sumFun();
  884. }
  885. recordValueChange(index, field, value) {
  886. const { orderCartData } = this.props;
  887. const newOrderCartData = orderCartData.concat([]);
  888. newOrderCartData[index][`${field}`] = value;
  889. this.props.dispatch({
  890. type: "orderEdit/orderCartData",
  891. orderCartData: newOrderCartData
  892. });
  893. }
  894. // 选配信息
  895. addGoodsOptsInfo(goodsOpts, rowIndex) {
  896. const { orderCartData, dispatch } = this.props;
  897. const optResult = [];
  898. const id = [];
  899. const newOrderCartData = orderCartData.concat([]);
  900. // BOM选配赋值todo...
  901. goodsOpts.forEach(goodsOpt => {
  902. if (newOrderCartData[rowIndex][`reqOrderItemBoms`]) {
  903. newOrderCartData[rowIndex][`reqOrderItemBoms`].forEach(reqOrderItemBom => {
  904. if (reqOrderItemBom.childGoodsId == goodsOpt.goodsId) {
  905. reqOrderItemBom.baseGoodsOptId = goodsOpt.id;
  906. reqOrderItemBom.baseGoodsOptValue = goodsOpt.optResult;
  907. }
  908. });
  909. }
  910. optResult.push(goodsOpt.optResult);
  911. id.push(goodsOpt.id);
  912. });
  913. newOrderCartData[rowIndex][`baseGoodsOptId`] = id.join(",");
  914. newOrderCartData[rowIndex][`baseGoodsOptValue`] = optResult.join(",");
  915. dispatch({
  916. type: "orderEdit/orderCartData",
  917. orderCartData: newOrderCartData
  918. });
  919. }
  920. // 购买数量改变
  921. buyNumChange(key, num) {
  922. const { orderCartData, dispatch } = this.props;
  923. const newOrderCartData = orderCartData.concat([]);
  924. const rowData = newOrderCartData[key];
  925. const rate = parseFloat(rowData.conversionRate || "1");
  926. newOrderCartData[key][`orderNum`] = +(num);
  927. newOrderCartData[key][`mainNum`] = +(num * rate);
  928. this.props.dispatch({
  929. type: "orderEdit/orderCartData",
  930. orderCartData: newOrderCartData
  931. });
  932. this.props.ifPromotion(true);
  933. }
  934. sumFun(data) {
  935. let orderCartData;
  936. if (data) {
  937. orderCartData = data;
  938. } else {
  939. orderCartData = this.props.orderCartData;
  940. }
  941. let newTotalAmount = 0; // 商品总金额
  942. let newTotalDealAmount = 0; // 商品促销后总金额
  943. let newAllWeight = 0; // 总重量
  944. let newAllVolume = 0; // 总体积
  945. let newTotalNum = 0; // 总数量(订货数量)
  946. let ext04 = 0;
  947. for (let i = 0; i < orderCartData.length; i++) {
  948. newTotalAmount +=
  949. parseFloat(orderCartData[i].salePrice || "0") *
  950. parseFloat(orderCartData[i].mainNum || "0");
  951. newTotalDealAmount +=
  952. parseFloat(orderCartData[i].promPrice || "0") *
  953. parseFloat(orderCartData[i].mainNum || "0") -
  954. parseFloat(orderCartData[i].promAmount || "0");
  955. newAllWeight += parseFloat(orderCartData[i].rowWeight);
  956. newAllVolume += parseFloat(orderCartData[i].rowVolume);
  957. newTotalNum += parseFloat(orderCartData[i].orderNum);
  958. ext04 += parseFloat(orderCartData[i].promPrice || "0") *
  959. parseFloat(orderCartData[i].mainNum || "0") -
  960. parseFloat(orderCartData[i].promAmount || "0")
  961. }
  962. this.fillGiftWeightAndVolume({
  963. newTotalAmount,
  964. newTotalDealAmount,
  965. newAllWeight,
  966. newAllVolume,
  967. newTotalNum,
  968. ext04
  969. });
  970. }
  971. // 如果有赠品,补充赠品体积重量
  972. fillGiftWeightAndVolume(value) {
  973. const { dispatch } = this.props;
  974. const { selectedGiftProms } = this.state;
  975. const newTotalAmount = value.newTotalAmount;
  976. const newTotalDealAmount = value.newTotalDealAmount;
  977. const ext04 = value.ext04;
  978. // 累加赠品数量、体积、重量
  979. let newTotalNum = value.newTotalNum;
  980. let newAllWeight = value.newAllWeight || 0;
  981. let newAllVolume = value.newAllVolume || 0;
  982. if (selectedGiftProms && selectedGiftProms.length > 0) {
  983. selectedGiftProms.forEach(giftProm => {
  984. const giftDtos = giftProm.giftDtos;
  985. if (giftDtos && giftDtos.length > 0) {
  986. giftDtos.forEach(gift => {
  987. newAllWeight += parseFloat(gift.rowWeight);
  988. newAllVolume += parseFloat(gift.rowVolume);
  989. newTotalNum += parseFloat(gift.orderNum);
  990. });
  991. }
  992. });
  993. }
  994. this.props.onChange({
  995. newTotalAmount,
  996. newTotalDealAmount,
  997. newAllWeight,
  998. newAllVolume,
  999. newTotalNum,
  1000. ext04
  1001. });
  1002. }
  1003. // 删除商品
  1004. delHandle(goodsItem) {
  1005. const { orderCartData, dispatch } = this.props;
  1006. // todo...
  1007. const newOrderCartData = orderCartData.filter(
  1008. item => goodsItem.goodsId != item.goodsId || goodsItem.ext05 != item.ext05
  1009. );
  1010. this.props.dispatch({
  1011. type: "orderEdit/orderCartData",
  1012. orderCartData: newOrderCartData
  1013. });
  1014. // 匹配促销信息
  1015. this.props.ifPromotion(true);
  1016. }
  1017. expandedRowRender(record) {
  1018. const promotions = record.reqOrderPromRels;
  1019. if (!promotions) return null;
  1020. promotions.forEach(item => {
  1021. let promWayName = "";
  1022. switch (item.promWay) {
  1023. case 1:
  1024. promWayName = "买赠";
  1025. break;
  1026. case 2:
  1027. promWayName = "降价";
  1028. break;
  1029. default:
  1030. break;
  1031. }
  1032. item.promWayName = promWayName;
  1033. });
  1034. return promotions.map(item => {
  1035. return (
  1036. <p className={styles.expandedTop}>
  1037. <span className={styles.giftTip}>{item.promWayName}</span>
  1038. <span>{item.description}</span>
  1039. </p>
  1040. );
  1041. });
  1042. }
  1043. render() {
  1044. // ifEditable 订单是否可编辑, 默认可编辑:true
  1045. const { orderCartData, ifEditable, promotionInfoData, projectData } = this.props;
  1046. const { selectedGiftProms, selectedPromStyle } = this.state;
  1047. if (!orderCartData || orderCartData.length < 1) return <EmptyData />;
  1048. // 往商品行上封装项目
  1049. orderCartData.forEach(item => {
  1050. item.projectData = projectData || [];
  1051. });
  1052. const giftColumns = this.giftColumns;
  1053. // 拼接买赠商品HTML
  1054. const getGiftItemsHtml = giftProm => {
  1055. const { selectedGoodsValues } = this.state;
  1056. if (!giftProm) return null;
  1057. const giftDtos = giftProm.giftDtos;
  1058. if (!giftDtos) return null;
  1059. const giftArray = [];
  1060. for (let i = 0; i < giftDtos.length; i += 6) {
  1061. giftArray.push(giftDtos.slice(i, i + 6));
  1062. }
  1063. return giftArray.map(gifts => {
  1064. return (
  1065. <Row gutter={16} className={styles.activityContent}>
  1066. {gifts.map(gift => {
  1067. return (
  1068. <Col
  1069. span="4"
  1070. key={`${gift.activityId}${gift.ruleId}${gift.goodsId}`}
  1071. >
  1072. <Card bordered={false} style={{ width: "100%" }}>
  1073. <div className={styles.cardImage}>
  1074. <Checkbox
  1075. checked={selectedGoodsValues.includes(
  1076. `${gift.activityId}${gift.ruleId}${gift.goodsId}${gift.giftId}`
  1077. )}
  1078. value={`${gift.activityId}${gift.ruleId}${
  1079. gift.goodsId}${gift.giftId}`}
  1080. className={styles.checkboxContent}
  1081. onChange={this.onCheckBoxChange.bind(this, gift, giftDtos)}
  1082. >
  1083. <img
  1084. alt=""
  1085. width="100%"
  1086. height="176px"
  1087. src={gift.goodsImg}
  1088. />
  1089. </Checkbox>
  1090. </div>
  1091. <div className={styles.goodsDisplayName}>
  1092. <p>{gift.goodsDisplayName}</p>
  1093. </div>
  1094. </Card>
  1095. </Col>
  1096. );
  1097. })}
  1098. </Row>
  1099. );
  1100. });
  1101. };
  1102. // 拼接买赠活动HTML
  1103. const getGiftActivityHtml = () => {
  1104. return promotionInfoData.giftProms.map(giftProm => {
  1105. return (
  1106. <div
  1107. className={styles.promotionActivtyRow}
  1108. key={`${giftProm.activityId}${giftProm.ruleId}`}
  1109. >
  1110. <Row className={styles.activtyTitle}>
  1111. <Col span="24">
  1112. <span className={styles.giftTip}>买赠</span>
  1113. <span>{giftProm.description}</span>
  1114. </Col>
  1115. </Row>
  1116. {getGiftItemsHtml(giftProm)}
  1117. </div>
  1118. );
  1119. });
  1120. };
  1121. // 拼接已选的买赠商品HTML
  1122. const getSelectedGiftItemsHtml = giftProm => {
  1123. if (!giftProm) return null;
  1124. const giftDtos = giftProm.giftDtos;
  1125. if (!giftDtos) return null;
  1126. return (
  1127. <Row className={styles.activityContent}>
  1128. {
  1129. <Table
  1130. className={styles.selectedGiftTable}
  1131. showHeader={false}
  1132. // scroll={{ y: 250 }}
  1133. pagination={false}
  1134. dataSource={giftDtos}
  1135. columns={giftColumns}
  1136. />
  1137. }
  1138. </Row>
  1139. );
  1140. };
  1141. // 拼接已选的买赠活动HTML
  1142. const getSelectedGiftActivityHtml = () => {
  1143. if (!selectedGiftProms || selectedGiftProms.length < 1) {
  1144. return null;
  1145. }
  1146. return selectedGiftProms.map(giftProm => {
  1147. return (
  1148. <div
  1149. className={styles.promotionActivtyRow}
  1150. key={`${giftProm.activityId}${giftProm.ruleId}`}
  1151. style={{
  1152. display:
  1153. giftProm.giftDtos && giftProm.giftDtos.length > 0
  1154. ? "block"
  1155. : "none"
  1156. }}
  1157. >
  1158. <Row className={styles.activtyTitle}>
  1159. <Col span="24">
  1160. <span className={styles.giftTip}>买赠</span>
  1161. <span>{giftProm.description}</span>
  1162. </Col>
  1163. </Row>
  1164. {getSelectedGiftItemsHtml(giftProm)}
  1165. </div>
  1166. );
  1167. });
  1168. };
  1169. const getPromStyleRadioHtml = promStyles => {
  1170. if (!promStyles) return null;
  1171. const val = promStyles.join(",");
  1172. return promStyles.map(style => {
  1173. let styleName = "买赠-基于商品";
  1174. if (style == 2) {
  1175. styleName = "降价-基于商品";
  1176. } else if (style == 3) {
  1177. styleName = "买赠-基于订单";
  1178. } else if (style == 4) {
  1179. styleName = "降价-基于订单";
  1180. }
  1181. return (
  1182. <Radio value={val} className={styles.radioRight40}>
  1183. {styleName}
  1184. </Radio>
  1185. );
  1186. });
  1187. };
  1188. const getPromoStyleHtml = () => {
  1189. if (!selectedPromStyle || !promotionInfoData.mutualRelationShip) {
  1190. return null;
  1191. }
  1192. return (
  1193. <RadioGroup
  1194. className={styles.radioGroup}
  1195. onChange={this.onRadioChangeHandle.bind(this)}
  1196. value={selectedPromStyle}
  1197. >
  1198. {getPromStyleRadioHtml(promotionInfoData.mutualRelationShip[0])}
  1199. {getPromStyleRadioHtml(promotionInfoData.mutualRelationShip[1])}
  1200. </RadioGroup>
  1201. );
  1202. };
  1203. const getGiftPromsHtml = () => {
  1204. if (
  1205. !promotionInfoData ||
  1206. !promotionInfoData.giftProms ||
  1207. promotionInfoData.giftProms.length < 1
  1208. ) {
  1209. return null;
  1210. }
  1211. return (
  1212. <Tabs defaultActiveKey="1" className={styles.promotionGiftBox}>
  1213. <TabPane tab="可选赠品" key="1">
  1214. {getGiftActivityHtml()}
  1215. </TabPane>
  1216. <TabPane tab="已选赠品" key="2">
  1217. {getSelectedGiftActivityHtml()}
  1218. </TabPane>
  1219. </Tabs>
  1220. );
  1221. };
  1222. // 整单降价促销
  1223. const getOrderPriceCutHtml = () => {
  1224. if (!promotionInfoData || !promotionInfoData.orderPriceProm) return null;
  1225. return (
  1226. <div className={styles.orderPriceCutTitle}>
  1227. <span className={styles.priceTip}>降价</span>
  1228. <span>{promotionInfoData.orderPriceProm.description}</span>
  1229. </div>
  1230. );
  1231. };
  1232. const getPromotionInfoHtml = () => {
  1233. // 货补不展示促销信息
  1234. if (!ifEditable) return null;
  1235. return (
  1236. <div style={{ width: "100%" }}>
  1237. {/* 整单降价促销提示 start */}
  1238. {getOrderPriceCutHtml()}
  1239. {/* 整单降价促销提示 end */}
  1240. {/* 订单促销维度选择 start */}
  1241. {getPromoStyleHtml()}
  1242. {/* 订单促销维度选择 end */}
  1243. {/* 促销赠品选择 start */}
  1244. {getGiftPromsHtml()}
  1245. {/* 促销赠品选择 end */}
  1246. </div>
  1247. );
  1248. };
  1249. const columns = this.columns;
  1250. const bomColumns = this.bomColumns;
  1251. let orderItemBomData = [];
  1252. if (orderCartData && orderCartData.length > 0) {
  1253. orderItemBomData = translateItemBomFromItem(orderCartData);
  1254. }
  1255. // 默认展开促销活动
  1256. const expandedTop = true;
  1257. return (
  1258. <div className={styles.goodsListBox}>
  1259. {/* 商品行信息 start */}
  1260. <Tabs defaultActiveKey="product-tab" type="card">
  1261. <TabPane tab="商品信息" key="product-tab">
  1262. <GridTable
  1263. className={styles.goodsListGrid}
  1264. dataSource={orderCartData}
  1265. columns={columns}
  1266. expandedRowRender={this.expandedRowRender.bind(this)}
  1267. expandedOnRowsTop={expandedTop}
  1268. />
  1269. </TabPane>
  1270. {/* <TabPane tab="商品BOM信息" key="product-bom-tab">
  1271. <GridTable
  1272. className={styles.goodsListGrid}
  1273. dataSource={orderItemBomData}
  1274. columns={bomColumns}
  1275. />
  1276. </TabPane> */}
  1277. </Tabs>
  1278. {/* <Table
  1279. className={styles.goodsListGrid}
  1280. pagination={false}
  1281. dataSource={orderCartData}
  1282. columns={columns}
  1283. /> */}
  1284. {/* 商品行信息 end */}
  1285. {/* 促销信息 start */}
  1286. {getPromotionInfoHtml()}
  1287. {/* 促销信息 end */}
  1288. <GoodsOptsDialog
  1289. title="商品选配"
  1290. goodsOptsParam={this.state.goodsOptsParam}
  1291. onConfirm={this.addGoodsOptsInfo.bind(this)}
  1292. />
  1293. </div>
  1294. );
  1295. }
  1296. }
  1297. export default OrderGoodsList;