index.js 68 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017
  1. import React, { PureComponent } from "react";
  2. import { connect } from "dva";
  3. import { routerRedux } from "dva/router";
  4. import {
  5. Icon,
  6. Checkbox,
  7. Select,
  8. Input,
  9. DatePicker,
  10. Popover,
  11. Button,
  12. notification,
  13. message,
  14. Layout,
  15. Row,
  16. Col,
  17. Affix,
  18. Popconfirm,
  19. Spin,
  20. Tag,
  21. Modal
  22. } from "antd";
  23. import moment from "moment";
  24. import styles from "./index.less";
  25. import OrderGoodsList from "@/components/OrderGoodsList/index.js";
  26. import TreeListModal from "@/components/SelectDialog/TreeList/index";
  27. import InvoiceDialog from "@/components/InvoiceDialog/index";
  28. import { getCustomer, getDefaultCurrency } from "@/utils/request.js";
  29. import FormPayforDialog from "@/components/PayforDialog/index";
  30. import {
  31. setItemsDefaultData,
  32. getMaxOccupyMny,
  33. matchCustomerCast,
  34. ifSupplierIsOrg,
  35. translateItemBomFromItem
  36. } from "./orderTools";
  37. import { getGoodAndPalettePriceConAPI,saveGoodsOptsResultAPI, getOptByIdAPI } from "../../../services/api";
  38. const { Header, Content } = Layout;
  39. // 获取默认币种
  40. const currency = {
  41. id: getDefaultCurrency().id || "",
  42. currencySign: getDefaultCurrency().currencySign || "¥",
  43. currencyPriceScale: getDefaultCurrency().currencyPriceScale || 2,
  44. currencyAmountScale: getDefaultCurrency().currencyAmountScale || 2
  45. };
  46. const ifOptional = true;
  47. const ifStrucManage = true;
  48. class OrderEidt extends PureComponent {
  49. constructor(props) {
  50. super(props);
  51. this.customerId = getCustomer().id;
  52. this.customerRankCode = getCustomer().customerRankCode;
  53. this.ifPromotion = false; // 是否重新询促销
  54. this.ifOccupy = false; // 是否重新询费用
  55. this.ifCredit = false; // 是否重新询信用
  56. this.ifFillBom = false; // 是否重新补充BOM信息
  57. // this.promotionStyle = ""; // 促销维度
  58. this.giftItems = [];
  59. this.state = {
  60. ref: {},
  61. addressData: [], // 收货地址
  62. invoiceInfoData: [], // 发票
  63. btnTxt: "展开地址",
  64. iconType: "down",
  65. isShow: false, // 控制地址收起展开
  66. totalWeight: 0, // 总质量
  67. totalVolume: 0, // 总体积
  68. totalNum: 0, // 总数量
  69. totalDealAmount: 0, // 订单成交金额
  70. totalAmount: 0, // 商品总金额(订单原金额)
  71. promAmount: 0, // 促销金额
  72. supplierId: "", // 供应商
  73. transportModeId: "", // 运输方式
  74. settleModeId: "", // 结算方式
  75. underPaymentModeId: "", // 支付方式
  76. underPaymentModeCode: "",
  77. underPaymentModeName: "", // 支付方式name
  78. remark: "", // 订单备注
  79. deliveryDate: Date.now(), // 期望收货日期
  80. offsetAmount: 0, // 费用冲抵金额
  81. haveChecked: false, // 购物车下单,暂存订单编辑用到该参数
  82. supplierDisabled: false, // 供应商不可编辑,默认false
  83. srcOrderId: "", // 来源单据(原单主键)
  84. srcOrderCode: "", // 来源单据编号
  85. castTypeId: "", // 客户费用单类型主键(货补兑付)
  86. saleModel: "01", // 销售模式
  87. // 根据供货方是否组织,判断是否一级经销商,默认为一级经销商
  88. ifCashOrder: false, // 是否 货补兑付订单(一级渠道商才能使用货补)
  89. ifOneSupplier: true, // 是否一级渠道商
  90. ifEditOrder: false, // 是否是订单编辑
  91. loading: false, // 提交、暂存
  92. goodsLoading: false, // 商品行
  93. occupyMnyTopLimit: {},
  94. payNeedData: {},
  95. modalResultVisible: false,
  96. ifSubmit: false,
  97. isSubBut: false,
  98. actionType: "",
  99. isDisabled: false,
  100. optValShow: false,
  101. optSearchVal: "",
  102. optValSelectId: "",
  103. optVal: {
  104. baseGoodsOptValue: "",
  105. baseGoodsOptId: "",
  106. ext05: "",
  107. ext04: "",
  108. price: ""
  109. } ,
  110. currRow: -1,
  111. goodsAttrVals: []
  112. };
  113. }
  114. componentWillMount() {
  115. const { dispatch, location } = this.props;
  116. // 获取购物车商品(购物车下单)
  117. const cartData = location["cartData"];
  118. // 获取订单主键(订单编辑)
  119. const orderId = location[`orderId`];
  120. // 复制
  121. const query = location[`query`];
  122. // 货补兑付
  123. const cashOrderData = location[`cashOrderData`];
  124. dispatch({
  125. type: "orderEdit/getSupplierData",
  126. payload: null
  127. })
  128. .finally(() => {
  129. const { supplierData } = this.props;
  130. const { supplierId, saleModel } = this.state;
  131. if (supplierId) {
  132. // // 匹配账期
  133. // dispatch({
  134. // type: "orderEdit/getAccountPeriodInfo",
  135. // payload: {
  136. // saleOrg: supplierId, // 销售组织
  137. // customer: this.customerId, // 客户
  138. // saleModel: saleModel
  139. // }
  140. // });
  141. // 判断供应商是否为组织
  142. const isOrg = ifSupplierIsOrg(supplierId, supplierData);
  143. // 供应商是组织时,只设置ifOneSupplier为true,适配货补
  144. if (isOrg) {
  145. this.setState({
  146. ifOneSupplier: true
  147. });
  148. } else {
  149. this.setState({
  150. ifOneSupplier: false
  151. });
  152. }
  153. }
  154. });
  155. dispatch({
  156. type: "orderEdit/getAddressData",
  157. payload: null
  158. })
  159. .finally(() => {
  160. const { addressData, orderEditData } = this.props;
  161. // console.log("===");
  162. // console.log(orderEditData);
  163. // console.log(addressData);
  164. if (orderEditData && orderEditData.reqOrderReceiveAddress && orderEditData.reqOrderReceiveAddress.receiveAddressId && addressData) {
  165. addressData.forEach(item => {
  166. item.isSelected = "0";
  167. });
  168. (addressData.find(item => item.id == orderEditData.reqOrderReceiveAddress.receiveAddressId) || {}).isSelected = "1";
  169. this.setState({
  170. addressData: addressData
  171. });
  172. }
  173. });
  174. dispatch({
  175. type: "orderEdit/getLogisticsData",
  176. payload: null
  177. });
  178. dispatch({
  179. type: "orderEdit/getSettlementData",
  180. payload: null
  181. });
  182. dispatch({
  183. type: "orderEdit/getPayforMainData",
  184. payload: null
  185. });
  186. // 获取项目
  187. dispatch({
  188. type: "orderEdit/getProjectData",
  189. payload: {
  190. search_EQ_isEnable: 1
  191. }
  192. });
  193. dispatch({
  194. type: "orderEdit/getInvoiceInfoData",
  195. payload: null
  196. })
  197. .finally(() => {
  198. const { invoiceInfoData, orderEditData } = this.props;
  199. if (orderEditData && orderEditData.reqOrderInvoice &&
  200. orderEditData.reqOrderInvoice.invoiceId && invoiceInfoData
  201. ) {
  202. invoiceInfoData.forEach(item => {
  203. item.isDefault = "0";
  204. });
  205. (
  206. invoiceInfoData.find(
  207. item => item.id == orderEditData.reqOrderInvoice.invoiceId
  208. ) || {}
  209. ).isDefault =
  210. "1";
  211. this.setState({
  212. invoiceInfoData: invoiceInfoData
  213. });
  214. }
  215. });
  216. // 防止有历史数据,先清空订单商品,促销等相关信息
  217. dispatch({
  218. type: "orderEdit/orderEditData",
  219. orderEditData: null
  220. });
  221. dispatch({
  222. type: "orderEdit/orderCartData",
  223. orderCartData: []
  224. });
  225. dispatch({
  226. type: "orderEdit/occupyMnyTopLimits",
  227. occupyMnyTopLimits: null
  228. });
  229. dispatch({
  230. type: "orderEdit/orderCredit",
  231. orderCredit: {}
  232. });
  233. dispatch({
  234. type: "orderEdit/promotionInfoData",
  235. promotionInfoData: null
  236. });
  237. // 复制订单
  238. if (query && query.orderId) {
  239. dispatch({
  240. type: "orderEdit/getOrderEditDataForCopy",
  241. payload: {
  242. id: query.orderId
  243. }
  244. });
  245. this.setState({
  246. srcOrderId: query.orderId,
  247. srcOrderCode: query.orderCode,
  248. haveChecked: true
  249. });
  250. }
  251. // 订单编辑 (例如:订单暂存编辑、驳回编辑)
  252. if (orderId) {
  253. dispatch({
  254. type: "orderEdit/getOrderEditData",
  255. payload: {
  256. id: orderId
  257. }
  258. });
  259. this.setState({
  260. ifEditOrder: true,
  261. haveChecked: true
  262. });
  263. }
  264. // 购物车下单
  265. if (cartData) {
  266. dispatch({
  267. type: "orderEdit/orderCartData",
  268. orderCartData: setItemsDefaultData(cartData.cartlist, false)
  269. });
  270. this.setState({
  271. supplierId: cartData.saleOrgId || cartData.supplierId,
  272. ifOneSupplier: cartData.isPrimaryChannel == 1 ? true : false,
  273. supplierDisabled: true,
  274. goodsLoading: cartData.isPrimaryChannel == 1 ? true : false,
  275. haveChecked: true
  276. });
  277. }
  278. // 货补兑付下单 todo...
  279. if (cashOrderData) {
  280. dispatch({
  281. type: "orderEdit/orderCartData",
  282. orderCartData: setItemsDefaultData(cashOrderData.reqOrderItems, true)
  283. });
  284. this.setState({
  285. castTypeId: cashOrderData.castTypeId,
  286. supplierId: cashOrderData.saleOrgId,
  287. ifOneSupplier: true, // 一级经销商才能使用货补
  288. saleModel: "03",
  289. supplierDisabled: true,
  290. haveChecked: false,
  291. ifCashOrder: true
  292. });
  293. }
  294. }
  295. componentWillReceiveProps(nextProps) {
  296. const { dispatch, orderCartData, occupyMnyTopLimits } = nextProps;
  297. const { ifCashOrder, ifOneSupplier } = this.state;
  298. // 非货补订单重新询促销,先清空费用冲抵、促销、赠品信息
  299. if (this.ifPromotion && !ifCashOrder) {
  300. // 清空促销,赠品信息
  301. dispatch({
  302. type: "orderEdit/promotionInfoData",
  303. promotionInfoData: null
  304. });
  305. this.giftItems = [];
  306. this.setState({
  307. goodsLoading: true
  308. });
  309. // 如为一级经销商,则需重新匹配费用
  310. if (ifOneSupplier) {
  311. // 重新询促销,代表商品行信息发生改变,此时,重新匹配费用
  312. const occupyMnyTopLimit = matchCustomerCast(orderCartData, occupyMnyTopLimits);
  313. this.setState({
  314. offsetAmount: 0,
  315. occupyMnyTopLimit: occupyMnyTopLimit || {}
  316. });
  317. }
  318. }
  319. if ("promotionInfoData" in nextProps) {
  320. const promotionInfoData = nextProps.promotionInfoData;
  321. if (promotionInfoData && promotionInfoData.reqOrderItems) {
  322. dispatch({
  323. type: "orderEdit/orderCartData",
  324. orderCartData: promotionInfoData.reqOrderItems
  325. });
  326. }
  327. }
  328. if ("addressData" in nextProps) {
  329. const addressData = nextProps.addressData;
  330. this.setState({
  331. addressData: addressData
  332. });
  333. }
  334. if ("invoiceInfoData" in nextProps) {
  335. const invoiceInfoData = nextProps.invoiceInfoData;
  336. this.setState({
  337. invoiceInfoData: invoiceInfoData
  338. });
  339. }
  340. if ("orderCartData" in nextProps) {
  341. const orderCartData = nextProps.orderCartData;
  342. if (orderCartData && orderCartData.length > 0) {
  343. if (this.state.haveChecked) {
  344. // 查询促销信息
  345. this.ifPromotion = true;
  346. // 重新补充Bom信息
  347. this.ifFillBom = true;
  348. // 非货补下单且为一级渠道商下单,重新询费用
  349. if (!this.state.ifCashOrder && this.state.ifOneSupplier) {
  350. // 查询费用
  351. this.ifOccupy = true;
  352. }
  353. this.setState({
  354. haveChecked: false
  355. });
  356. }
  357. }
  358. }
  359. if ("orderEditData" in nextProps) {
  360. const orderEditData = nextProps.orderEditData;
  361. if (orderEditData && orderEditData.id) {
  362. if (this.state.haveChecked) {
  363. // todo...
  364. this.setState({
  365. supplierDisabled: (orderEditData.saleOrgId || orderEditData.supplierId) ? true : false,
  366. supplierId: orderEditData.saleOrgId || orderEditData.supplierId, // 供应商(一级渠道商为组织、非一级渠道商为上级客户)
  367. ifOneSupplier: orderEditData.saleOrgId ? true : false,
  368. transportModeId: orderEditData.transportModeId, // 运输方式
  369. settleModeId: orderEditData.settleModeId, // 结算方式
  370. underPaymentModeId: orderEditData.underPaymentModeId, // 支付方式
  371. underPaymentModeCode: orderEditData.underPaymentModeCode, // 支付方式
  372. underPaymentModeName: orderEditData.underPaymentModeName,
  373. remark: orderEditData.remark, // 订单备注
  374. deliveryDate: Date.now() // 期望收货日期
  375. });
  376. // todo...
  377. if (orderEditData.reqOrderItems.length > 0) {
  378. dispatch({
  379. type: "orderEdit/orderCartData",
  380. orderCartData: orderEditData.reqOrderItems
  381. });
  382. const { addressData, invoiceInfoData } = nextProps;
  383. if (
  384. orderEditData.reqOrderReceiveAddress &&
  385. orderEditData.reqOrderReceiveAddress.receiveAddressId
  386. ) {
  387. addressData.forEach(item => {
  388. item.isSelected = "0";
  389. });
  390. (
  391. addressData.find(
  392. item =>
  393. item.id ==
  394. orderEditData.reqOrderReceiveAddress.receiveAddressId
  395. ) || {}
  396. ).isSelected =
  397. "1";
  398. }
  399. if (
  400. orderEditData.reqOrderInvoice &&
  401. orderEditData.reqOrderInvoice.invoiceId
  402. ) {
  403. invoiceInfoData.forEach(item => {
  404. item.isDefault = "0";
  405. });
  406. (
  407. invoiceInfoData.find(
  408. item => item.id == orderEditData.reqOrderInvoice.invoiceId
  409. ) || {}
  410. ).isDefault =
  411. "1";
  412. }
  413. }
  414. }
  415. }
  416. }
  417. // 订单暂存、提交返回结果 todo...
  418. if ("resultOrder" in nextProps) {
  419. const resultOrder = nextProps.resultOrder;
  420. if (!resultOrder) return null;
  421. if (resultOrder.id) {
  422. let msg = "订单提交成功";
  423. if (resultOrder.orderStatusCode == "01") {
  424. msg = "订单暂存成功";
  425. if (this.state.underPaymentModeName == "在线支付" && this.state.isSubBut) {
  426. const currencyName = JSON.parse(localStorage["_A_P_currency"]).name;
  427. const payBillDatalist = {
  428. id: resultOrder.id
  429. };
  430. this.state.payNeedData = {
  431. total_amount: resultOrder.totalDealAmount,
  432. out_trade_no: resultOrder.orderCode,
  433. paymentModeName: resultOrder.paymentModeName,
  434. currencyName: currencyName,
  435. payBillData: payBillDatalist
  436. };
  437. dispatch({
  438. type: "paymentNotice/orderPayBillSet",
  439. orderPayBillSet: this.state.payNeedData
  440. });
  441. this.props.dispatch({
  442. type: "global/orderListVisible",
  443. payload: true
  444. });
  445. } else {
  446. setTimeout(() => {
  447. dispatch(routerRedux.push("/buyer/orderList"));
  448. }, 2000);
  449. }
  450. } else {
  451. // 删除购物车相关商品
  452. this.removeShopCart();
  453. }
  454. notification.success({
  455. message: msg,
  456. description: `订单号为${resultOrder.orderCode},2秒后跳转到订单列表页`,
  457. duration: 2
  458. });
  459. if (resultOrder.orderStatusCode == "01" && this.state.underPaymentModeName == "在线支付") {
  460. console.log("去支付");
  461. } else {
  462. setTimeout(() => {
  463. dispatch(routerRedux.push("/buyer/orderList"));
  464. }, 2000);
  465. }
  466. dispatch({
  467. type: "orderEdit/resultOrder",
  468. resultOrder: null
  469. });
  470. } else {
  471. const { ifSubmit } = this.state;
  472. if (!ifSubmit) return;
  473. let msg = "订单提交失败";
  474. if (resultOrder.orderStatusCode == "01") {
  475. msg = "订单暂存失败";
  476. }
  477. if (resultOrder.message) {
  478. msg = `${msg}:${resultOrder.message}`;
  479. }
  480. notification.error({
  481. message: msg,
  482. duration: 3
  483. });
  484. dispatch({
  485. type: "orderEdit/resultOrder",
  486. resultOrder: null
  487. });
  488. }
  489. }
  490. }
  491. componentDidUpdate() {
  492. const { orderCartData, dispatch, occupyMnyTopLimits } = this.props;
  493. const { supplierId, ifCashOrder, saleModel, ifOneSupplier } = this.state;
  494. // orderCartData.forEach(item => {
  495. // console.log(`=================================${item.dealAmount}`);
  496. // return item;
  497. // });
  498. // 非货补订单询促销
  499. if (!ifCashOrder && this.ifPromotion) {
  500. // 匹配促销信息
  501. dispatch({
  502. type: "orderEdit/getPromotionInfo",
  503. payload: {
  504. saleOrgId: supplierId, // 销售组织
  505. customerId: this.customerId, // 客户
  506. // isPrimaryChannel: ifOneSupplier ? 1 : 0, // 是否一级渠道商
  507. orderType: "reqOrder",
  508. reqOrderItems: orderCartData // 商品行信息
  509. }
  510. })
  511. .finally(() => {
  512. this.setState({
  513. goodsLoading: false
  514. });
  515. // 非货补下单且为一级渠道商下单,检测信用
  516. if (!this.state.ifCashOrder && this.state.ifOneSupplier) {
  517. this.checkCreditHandle();
  518. }
  519. // 重新补充BOM信息
  520. if (this.ifFillBom) {
  521. this.LinkGoodsBomInfo();
  522. }
  523. // this.LinkGoodsBomInfo();
  524. });
  525. this.giftItems = [];
  526. this.ifPromotion = false;
  527. }
  528. // 非货补下单且为一级渠道商下单,匹配费用,检测信用
  529. if (!ifCashOrder && ifOneSupplier) {
  530. if (this.ifOccupy) {
  531. // 匹配费用
  532. dispatch({
  533. type: "orderEdit/getOccupyMnyTopLimit",
  534. payload: {
  535. saleOrgId: supplierId, // 销售组织
  536. customerId: this.customerId // 客户
  537. }
  538. })
  539. .finally(() => {
  540. const occupyMnyTopLimit = matchCustomerCast(orderCartData, this.props.occupyMnyTopLimits);
  541. this.setState({
  542. occupyMnyTopLimit: occupyMnyTopLimit || {}
  543. });
  544. });
  545. this.ifOccupy = false;
  546. }
  547. if (this.ifCredit) {
  548. this.checkCreditHandle();
  549. this.ifCredit = false;
  550. }
  551. }
  552. }
  553. // 设为默认地址
  554. setDefaultHandle(index) {
  555. let { addressData } = this.state;
  556. addressData = Array.isArray(addressData)
  557. ? addressData
  558. : Object.values(addressData);
  559. // 设置默认收获地址
  560. this.props.dispatch({
  561. type: "orderEdit/setDefaultAddress",
  562. payload: {
  563. customer: this.customerId, // 客户id
  564. id: addressData[index].id // 收获地址id
  565. }
  566. })
  567. .finally((res) => {
  568. res.forEach(item => {
  569. if (!!item.isDefault) item.isSelected = "1";
  570. else item.isSelected = "0";
  571. });
  572. /*
  573. if (res) {
  574. addressData.forEach(item => {
  575. item.isDefault = "0";
  576. item.isSelected = "0";
  577. });
  578. addressData[index].isDefault = "1";
  579. addressData[index].isSelected = "1";
  580. }
  581. */
  582. this.setState({
  583. addressData: Object.assign({}, res)
  584. });
  585. });
  586. /*
  587. addressData.forEach(item => {
  588. item.isDefault = "0";
  589. item.isSelected = "0";
  590. });
  591. addressData[index].isDefault = "1";
  592. addressData[index].isSelected = "1";
  593. this.setState({
  594. addressData: Object.assign({}, addressData)
  595. });
  596. */
  597. }
  598. // 结算方式改变
  599. settlementChange(value) {
  600. this.setState({
  601. settleModeId: value
  602. });
  603. }
  604. // 支付方式
  605. payforMainChange(value) {
  606. const { payforMainData } = this.props;
  607. let payModl = "", code = "";
  608. for (var i = 0; i < payforMainData.length; i++) {
  609. if (payforMainData[i].id == value) {
  610. payModl = payforMainData[i].name;
  611. code = payforMainData[i].code;
  612. }
  613. }
  614. this.setState({
  615. underPaymentModeId: value,
  616. underPaymentModeCode: code,
  617. underPaymentModeName: payModl
  618. });
  619. }
  620. checkCreditHandle() {
  621. // const { orderCartData, dispatch } = this.props;
  622. // const { supplierId, saleModel } = this.state;
  623. // if (supplierId && orderCartData && Array.isArray(orderCartData)) {
  624. // // 信用检测
  625. // dispatch({
  626. // type: "orderEdit/orderCreditChecker",
  627. // payload: {
  628. // saleOrgId: supplierId, // 销售组织
  629. // customerId: this.customerId, // 客户
  630. // saleModel: saleModel,
  631. // reqOrderItems: orderCartData // 商品行信息
  632. // }
  633. // });
  634. // }
  635. }
  636. // 联查BOM信息
  637. LinkGoodsBomInfo() {
  638. const { dispatch, orderCartData } = this.props;
  639. dispatch({
  640. type: "orderEdit/getItemBomInfo",
  641. payload: {
  642. reqOrderItems: orderCartData // 商品行信息
  643. }
  644. });
  645. this.ifFillBom = false;
  646. }
  647. // 删除购物车商品
  648. removeShopCart() {
  649. const { orderCartData, cartListData, dispatch } = this.props;
  650. if (!cartListData || !Array.isArray(cartListData)) return;
  651. if (!orderCartData || !Array.isArray(orderCartData)) return;
  652. const { supplierId } = this.state;
  653. const cartIds = [];
  654. for (let i = 0; i < cartListData.length; i++) {
  655. const saleOrgId = cartListData[i].saleOrgId || cartListData[i].supplierId;
  656. if (saleOrgId == supplierId) {
  657. const newCartlistData = cartListData[i].cartlist;
  658. if (newCartlistData && newCartlistData.length > 0) {
  659. orderCartData.forEach(orderItem => {
  660. const cart = newCartlistData.find(item => item.goodsId == orderItem.goodsId);
  661. if (cart && cart.id) {
  662. cartIds.push(cart.id);
  663. }
  664. });
  665. }
  666. }
  667. }
  668. if (cartIds && cartIds.length > 0) {
  669. const cartId = cartIds.join(",");
  670. dispatch({
  671. type: "cartList/deleteCartListData",
  672. payload: { id: cartId }
  673. });
  674. }
  675. }
  676. selectAddressHandle(index) {
  677. let { addressData } = this.state;
  678. addressData = Array.isArray(addressData)
  679. ? addressData
  680. : Object.values(addressData);
  681. addressData.forEach(item => {
  682. item.isSelected = "0";
  683. });
  684. addressData[index].isSelected = "1";
  685. this.setState({
  686. addressData: Object.assign({}, addressData)
  687. });
  688. }
  689. promotionChangeHandle(style) {
  690. const { orderCartData, dispatch, promotionInfoData } = this.props;
  691. const mutualRelationShip = promotionInfoData.mutualRelationShip;
  692. const { supplierId, ifCashOrder, ifOneSupplier } = this.state;
  693. if (!ifCashOrder) {
  694. dispatch({
  695. type: "orderEdit/getPromotionInfo",
  696. payload: {
  697. saleOrgId: supplierId, // 销售组织
  698. customerId: this.customerId, // 客户
  699. isPrimaryChannel: ifOneSupplier ? 1 : 0, // 是否一级渠道商
  700. promotionStyle: style,
  701. reqOrderItems: orderCartData // 商品行信息
  702. }
  703. })
  704. .finally(() => {
  705. const { dispatch, promotionInfoData } = this.props;
  706. const newPromotionInfoData = Object.assign({}, promotionInfoData);
  707. newPromotionInfoData.giftProms = promotionInfoData.giftProms;
  708. newPromotionInfoData.orderPriceProm = promotionInfoData.orderPriceProm;
  709. newPromotionInfoData.reqOrderItems = promotionInfoData.reqOrderItems;
  710. newPromotionInfoData.mutualRelationShip = mutualRelationShip;
  711. dispatch({
  712. type: "orderEdit/promotionInfoData",
  713. promotionInfoData: newPromotionInfoData
  714. });
  715. });
  716. this.giftItems = [];
  717. }
  718. }
  719. async onOptClick(goods, index) {
  720. const attrs = await getOptByIdAPI({id: goods.goodsId, groupId: "", colourCode:""});
  721. this.setState({
  722. currRow: index,
  723. optValShow: true,
  724. goodsAttrVals: attrs[0].goodsAttrVals
  725. })
  726. }
  727. selectColor(optValSelectId) {
  728. this.setState({
  729. optValSelectId
  730. });
  731. }
  732. async confirmColor(color) {
  733. const { dispatch, orderCartData, supplierData } = this.props;
  734. let goodsDetail = {...orderCartData[this.state.currRow]}
  735. let existRow = orderCartData.findIndex((item,index) => item.ext05 == color.attrValId && item.goodsId == color.goodsId && index != this.state.currRow)
  736. if (existRow >= 0) {
  737. message.info("所选颜色商品已存在,请重新选择!");
  738. return
  739. }
  740. const params = {
  741. organizationId: supplierData[0].id,
  742. customerId: getCustomer().id,
  743. goodsId: goodsDetail.goodsId,
  744. orderTypeId: '01',
  745. paletteId: color.attrValId,
  746. shopId: ''
  747. }
  748. const result = await getGoodAndPalettePriceConAPI(params)
  749. if (result.length) {
  750. const optParams = [{
  751. goodsOptDtos: [{
  752. goodsId: goodsDetail.goodsId,
  753. goodsOptVals: [color],
  754. optResult: color.custDocGroupName+ ":" + color.attrValName,
  755. uniqueKey: goodsDetail.goodsId
  756. }]
  757. }]
  758. const opt = await saveGoodsOptsResultAPI(optParams);
  759. const price = result[0].price
  760. const priceAndMny = {
  761. promPrice : price,
  762. basePrice : price,
  763. dealPrice : price,
  764. salePrice : price,
  765. ext09 : price,
  766. ext10 : price * goodsDetail.orderNum,
  767. amount : price * goodsDetail.orderNum,
  768. dealAmount : goodsDetail.amount,
  769. baseGoodsOptId : opt[0].goodsOptDtos[0].id,
  770. baseGoodsOptValue : color.custDocGroupName+ ":" + color.attrValName,
  771. ext05 : color.attrValCode
  772. }
  773. let newItem = Object.assign({},goodsDetail,priceAndMny)
  774. orderCartData.splice(this.state.currRow,1,newItem)
  775. dispatch({
  776. type: "orderEdit/orderCartData",
  777. orderCartData: [...orderCartData]
  778. })
  779. }
  780. }
  781. // 备注改变
  782. remarkChange(e) {
  783. this.setState({
  784. remark: e.target.value
  785. });
  786. }
  787. // 收货日期改变
  788. dateChange(date, datestring) {
  789. this.setState({
  790. deliveryDate: datestring
  791. });
  792. }
  793. // 物流方式改变
  794. logisticsChange(value) {
  795. this.setState({
  796. transportModeId: value
  797. });
  798. }
  799. // 供应商改变
  800. supplierChange(value) {
  801. const { dispatch, supplierData } = this.props;
  802. const { supplierId, saleModel } = this.state;
  803. // 匹配账期
  804. // dispatch({
  805. // type: "orderEdit/getAccountPeriodInfo",
  806. // payload: {
  807. // saleOrg: value, // 销售组织
  808. // customer: this.customerId, // 客户
  809. // saleModel: saleModel
  810. // }
  811. // });
  812. // 判断供应上是否为组织
  813. const isOrg = ifSupplierIsOrg(value, supplierData);
  814. // 供应商是组织时,只设置ifOneSupplier为true,适配货补
  815. if (isOrg) {
  816. this.setState({
  817. supplierId: value,
  818. ifOneSupplier: true
  819. });
  820. this.ifOccupy = true;
  821. } else {
  822. this.setState({
  823. supplierId: value,
  824. ifOneSupplier: false
  825. });
  826. }
  827. dispatch({
  828. type: "orderEdit/orderCartData",
  829. orderCartData: []
  830. });
  831. // 促销
  832. dispatch({
  833. type: "orderEdit/promotionInfoData",
  834. promotionInfoData: null
  835. });
  836. this.giftItems = [];
  837. // 信用检测
  838. dispatch({
  839. type: "orderEdit/orderCredit",
  840. orderCredit: {}
  841. });
  842. // 清空促销
  843. dispatch({
  844. type: "orderEdit/occupyMnyTopLimits",
  845. occupyMnyTopLimits: null
  846. });
  847. }
  848. // 票扣改变时
  849. custfeeChange(e) {
  850. e.preventDefault();
  851. const value = e.target.value;
  852. const reg = /^-?(0|[1-9][0-9]*)(\.[0-9]*)?$/;
  853. if (value.length == 0) {
  854. this.setState({
  855. offsetAmount: value
  856. });
  857. } else {
  858. if (value.length > 1 && value.indexOf("0") == 0 && value.indexOf(".") != 1) {
  859. this.setState({
  860. offsetAmount: parseFloat(value)
  861. });
  862. } else {
  863. if (value && reg.test(value)) {
  864. this.setState({
  865. offsetAmount: value
  866. });
  867. } else {
  868. message.info("请输入有效金额!");
  869. }
  870. }
  871. }
  872. }
  873. // 票扣输入框失去焦点时
  874. custfeeBlur() {
  875. const { totalAmount, promAmount, offsetAmount, occupyMnyTopLimit } = this.state;
  876. const max = getMaxOccupyMny(
  877. occupyMnyTopLimit,
  878. totalAmount,
  879. totalAmount - promAmount
  880. );
  881. let value = +offsetAmount;
  882. if (value > max) {
  883. value = max;
  884. message.info("您录入的费用冲抵金额不能超出本次最高可冲抵金额!");
  885. }
  886. if (value < 0) {
  887. value = 0;
  888. }
  889. value = +(value.toFixed(currency.currencyAmountScale));
  890. this.setState({
  891. offsetAmount: value,
  892. totalDealAmount: totalAmount - promAmount - value
  893. });
  894. this.ifCredit = true;
  895. }
  896. // 获取商品信息
  897. goodsInfoChange(value) {
  898. const { totalDealAmount, promAmount, occupyMnyTopLimit } = this.state;
  899. const offsetAmount = +this.state.offsetAmount;
  900. /**
  901. * 促销金额 = 商品总金额-商品促销后总金额
  902. * 订单金额 = 商品促销后总金额 - 冲抵金额
  903. */
  904. this.setState({
  905. totalAmount: value.newTotalAmount,
  906. promAmount: value.newTotalAmount - value.newTotalDealAmount,
  907. totalDealAmount: value.newTotalDealAmount - offsetAmount,
  908. totalWeight: value.newAllWeight,
  909. totalVolume: value.newAllVolume,
  910. totalNum: value.newTotalNum
  911. });
  912. }
  913. // 展开收起地址
  914. showAddressClick() {
  915. this.setState({
  916. btnTxt: this.state.btnTxt == "展开地址" ? "收起地址" : "展开地址",
  917. iconType: this.state.iconType == "down" ? "up" : "down",
  918. isShow: !this.state.isShow
  919. });
  920. }
  921. // 取消
  922. cancelHandle() {
  923. const { dispatch } = this.props;
  924. const { ifCashOrder, ifOneSupplier } = this.state;
  925. // 如果是货补兑付订单,则点击取消返回货补兑付列表页
  926. if (ifCashOrder && ifOneSupplier) {
  927. dispatch(routerRedux.push("/buyer/goodsSupplyList"));
  928. } else {
  929. dispatch(routerRedux.push("/buyer/orderList"));
  930. }
  931. }
  932. // 暂存
  933. saveTempHandle(isSubmit) {
  934. const { dispatch } = this.props;
  935. const postData = this.packageOrderData();
  936. const warnInfo = this.validOrderData(postData);
  937. if (warnInfo) {
  938. message.warning(warnInfo);
  939. return false;
  940. }
  941. this.setState({
  942. loading: true,
  943. ifSubmit: true,
  944. isSubBut: false
  945. });
  946. dispatch({
  947. type: "orderEdit/saveTempOrder",
  948. payload: postData
  949. })
  950. .finally(() => {
  951. this.setState({
  952. loading: false,
  953. isDisabled: true
  954. });
  955. });
  956. }
  957. // 提交
  958. okHandle() {
  959. const { dispatch, orderCredit, payforMainData, accountPeriodInfo } = this.props;
  960. const { ifCashOrder, castTypeId, ifOneSupplier, underPaymentModeId } = this.state;
  961. let postData = this.packageOrderData();
  962. // 提交订单时,如有买赠或整单降价,则补充相应信息
  963. postData = this.fillOrderPriceCutAndGiftRows(postData);
  964. // 补充BOM信息
  965. postData = this.fillGoodsBomInfo(postData);
  966. let warnInfo = this.validOrderData(postData);
  967. // 货补兑付时,补充客户费用单主键 todo...
  968. if (ifCashOrder && ifOneSupplier) {
  969. if (!castTypeId) {
  970. warnInfo += "未获取到客户费用单主键,请重新下单! ";
  971. }
  972. postData.saleModel = "03"; // 货补下单时,销售模式为03
  973. postData.offsetAmount = postData.totalDealAmount;
  974. postData.totalAmount = 0;
  975. postData.totalDealAmount = 0;
  976. postData.costTypeId = castTypeId;
  977. postData.reqOrderItems.forEach(item => {
  978. if (item.isGift != 1) {
  979. item.offsetAmount = item.dealAmount;
  980. }
  981. });
  982. }
  983. if (warnInfo) {
  984. message.warning(warnInfo);
  985. return false;
  986. }
  987. this.setState({
  988. loading: true,
  989. ifSubmit: true
  990. });
  991. if (this.state.underPaymentModeName == "在线支付") {
  992. // this.saveTempHandle(true);
  993. this.setState({ isSubBut: true });
  994. dispatch({
  995. type: "orderEdit/saveTempOrder",
  996. payload: postData
  997. })
  998. .finally(() => {
  999. this.setState({
  1000. loading: false
  1001. });
  1002. });
  1003. return;
  1004. }
  1005. if (orderCredit && orderCredit.validMessage) {
  1006. message.info(orderCredit.validMessage);
  1007. }
  1008. // totalDealAmount: 0, // 订单成交金额
  1009. // totalAmount: 0, // 商品总金额(订单原金额)
  1010. // if (parseFloat(orderCredit) + parseFloat(postData.totalDealAmount) < parseFloat(postData.totalAmount)) {
  1011. // message.info("信用不足!");
  1012. // }
  1013. // if (!accountPeriodInfo || !accountPeriodInfo.name) {
  1014. // message.info("未匹配到账期");
  1015. // }
  1016. dispatch({
  1017. type: "orderEdit/submitOrder",
  1018. payload: postData
  1019. }).finally((data) => {
  1020. this.setState({
  1021. loading: false
  1022. });
  1023. });
  1024. }
  1025. // 补充整单降价、赠品行信息
  1026. fillOrderPriceCutAndGiftRows(postData) {
  1027. const giftItems = this.giftItems;
  1028. const { promotionInfoData } = this.props;
  1029. // 如有整单降价,则在表头上补充整单降价促销信息
  1030. if (promotionInfoData && promotionInfoData.orderPriceProm) {
  1031. const orderPriceProm = promotionInfoData.orderPriceProm;
  1032. postData.reqOrderPromRels = [
  1033. {
  1034. activityId: orderPriceProm.activityId,
  1035. ruleId: orderPriceProm.ruleId,
  1036. description: orderPriceProm.description,
  1037. promWay: 2, // 1 买赠 2 降价
  1038. isWhole: 1 // 1 整单
  1039. }
  1040. ];
  1041. }
  1042. if (giftItems && giftItems.length > 0) {
  1043. const giftRows = [];
  1044. giftItems.forEach(giftProm => {
  1045. const giftDtos = giftProm.giftDtos;
  1046. if (giftDtos && giftDtos.length > 0) {
  1047. giftDtos.forEach(gift => {
  1048. // 封装赠品行信息
  1049. const translate = {
  1050. id: null,
  1051. isGift: 1,
  1052. basePrice: 0,
  1053. salePrice: 0,
  1054. promPrice: 0,
  1055. dealPrice: 0,
  1056. ext09:0,
  1057. ext10:0,
  1058. amount: 0, // 金额
  1059. promAmount: 0, // 均摊到行上的整单降价促销金额
  1060. dealAmount: 0, // 成交金额
  1061. offsetAmount: 0, // 均摊到行上的费用冲抵金额
  1062. reqOrderPromRels: [
  1063. {
  1064. ruleId: giftProm.ruleId,
  1065. ruleCode: giftProm.ruleCode,
  1066. ruleName: giftProm.ruleName,
  1067. activityId: giftProm.activityId,
  1068. activityCode: giftProm.activityCode,
  1069. activityName: giftProm.activityName,
  1070. giftId: gift.giftId,
  1071. description: giftProm.description,
  1072. combineType: giftProm.combineType, // 组合类型 1 固定组合
  1073. goodCombineNum: giftProm.goodCombineNum, // 固定组合类商品基准数量
  1074. promWay: 1, // 1 买赠 2 降价
  1075. isWhole: 0
  1076. }
  1077. ]
  1078. };
  1079. const newGift = Object.assign({}, gift, translate);
  1080. giftRows.push(newGift);
  1081. });
  1082. }
  1083. });
  1084. // 如果赠品行不为空,则补充到订单表体行
  1085. if (giftRows.length > 0) {
  1086. const reqOrderItems = postData.reqOrderItems;
  1087. const newReqOrderItems = reqOrderItems.concat(giftRows);
  1088. postData.reqOrderItems = newReqOrderItems;
  1089. }
  1090. }
  1091. return postData;
  1092. }
  1093. // 补充BOM信息
  1094. fillGoodsBomInfo(postData) {
  1095. const reqOrderItems = postData.reqOrderItems;
  1096. const reqOrderItemBoms = translateItemBomFromItem(reqOrderItems);
  1097. postData.reqOrderItems = reqOrderItems;
  1098. postData.reqOrderItemBoms = reqOrderItemBoms;
  1099. return postData;
  1100. }
  1101. // 校验订单数据
  1102. validOrderData(postData) {
  1103. if (!postData) return "订单信息有误,请重新下单!";
  1104. let msg = "";
  1105. if (!this.state.supplierId) {
  1106. msg += "供应商不能为空!";
  1107. }
  1108. if (!this.state.underPaymentModeId) {
  1109. msg += "请输入支付方式!";
  1110. }
  1111. // if (!postData.transportModeId) {
  1112. // msg += "运输方式不能为空!";
  1113. // }
  1114. // if (!postData.settleModeId) {
  1115. // msg += "结算方式不能为空!";
  1116. // }
  1117. if (!postData.deliveryDate) {
  1118. msg += "期望到货日期不能为空!";
  1119. }
  1120. if (
  1121. !postData.reqOrderReceiveAddress ||
  1122. !postData.reqOrderReceiveAddress.receiveAddressId
  1123. ) {
  1124. msg += "收货地址信息不能为空!";
  1125. }
  1126. if (!postData.reqOrderInvoice || !postData.reqOrderInvoice.invoiceId) {
  1127. msg += "发票信息不能为空!";
  1128. }
  1129. if (!postData.reqOrderItems || postData.reqOrderItems.length < 1) {
  1130. msg += "商品信息不能为空!";
  1131. }
  1132. // postData.reqOrderItems.forEach((item, index) => {
  1133. // if (!item.salePrice || !item.stock || parseFloat(item.salePrice) <= 0 || parseFloat(item.stock) <= 0) {
  1134. // msg += `第${index + 1}行商品【${item.goodsDisplayName}】无价格或无库存,不可下单,请修改!`;
  1135. // }
  1136. // });
  1137. return msg;
  1138. }
  1139. // 封装订单信息
  1140. packageOrderData() {
  1141. const { orderCartData, location, orderEditData } = this.props;
  1142. const {
  1143. id,
  1144. supplierId,
  1145. transportModeId,
  1146. settleModeId,
  1147. underPaymentModeId,
  1148. underPaymentModeCode,
  1149. remark,
  1150. deliveryDate,
  1151. invoiceInfoData,
  1152. totalAmount,
  1153. totalDealAmount,
  1154. offsetAmount,
  1155. totalWeight,
  1156. totalVolume,
  1157. srcOrderId,
  1158. srcOrderCode,
  1159. totalNum,
  1160. ifEditOrder,
  1161. saleModel,
  1162. ifOneSupplier
  1163. } = this.state;
  1164. // 默认地址
  1165. let addressData = this.state.addressData;
  1166. addressData = Array.isArray(addressData)
  1167. ? addressData
  1168. : Object.values(addressData);
  1169. const addressDefault = addressData.find(item => item.isSelected == "1") || {};
  1170. // 默认发票
  1171. const invoiceInfoDefault = invoiceInfoData.find(
  1172. item => item.isDefault == "1"
  1173. ) || {};
  1174. // todo...
  1175. orderCartData.forEach(item => {
  1176. item.reqOrderId = null;
  1177. item.id = null;
  1178. if (item.reqOrderPromRels) {
  1179. item.reqOrderPromRels.forEach(promRel => {
  1180. promRel.isWhole = 0;
  1181. });
  1182. }
  1183. });
  1184. const postData = {
  1185. // todo...
  1186. id: ifEditOrder ? orderEditData.id : "",
  1187. orderCode: ifEditOrder ? orderEditData.orderCode : "",
  1188. customerId: this.customerId,
  1189. saleOrgId: ifOneSupplier ? supplierId : "", // 销售组织 (一级经销商)
  1190. supplierId: ifOneSupplier ? "" : supplierId, // 供应商(非一级经销商)
  1191. saleModel: "01", // 销售模式(正向时默认01:正向销售)
  1192. transportModeId: transportModeId, // 运输方式
  1193. settleModeId: settleModeId, // 结算方式
  1194. underPaymentModeId: underPaymentModeCode, // 支付方式
  1195. deliveryDate: deliveryDate, // 期望收货日期
  1196. totalNum: "", // 总数量
  1197. currency: currency.id, // 币种
  1198. currencySign: currency.currencySign, // 币符
  1199. currencyPriceScale: currency.currencyPriceScale, // 币种单价精度
  1200. currencyAmountScale: currency.currencyAmountScale, // 币种金额精度
  1201. totalAmount: totalAmount, // 原金额
  1202. totalDealAmount: totalDealAmount, // 成交金额
  1203. totalWeight: totalWeight, // 总重量
  1204. totoalVolume: totalVolume, // 总体积
  1205. totalNum: totalNum, // 总数量
  1206. reqOrderSource: "01", // 门户
  1207. srcOrderId: srcOrderId,
  1208. srcOrderCode: srcOrderCode,
  1209. remark: remark, // 订单备注
  1210. offsetAmount: offsetAmount, // 费用冲抵金额
  1211. reqOrderReceiveAddress: {
  1212. reqOrderId: id,
  1213. receiveAddressId: addressDefault.id, // 收货地址id
  1214. receiver: addressDefault.receiver, // 收货人
  1215. receiverTel: addressDefault.receiverTel, // 电话
  1216. receiverPhone: addressDefault.receiverPhone, // 手机
  1217. countryId: addressDefault.countryId,
  1218. receiverProvince: addressDefault.receiverProvince, // 省
  1219. receiverProvinceId: addressDefault.receiveAddressId,
  1220. receiverCity: addressDefault.receiverCity, // 市
  1221. receiverCityId: addressDefault.receiverCityId,
  1222. receiverCounty: addressDefault.receiverCounty, // 县
  1223. receiverCountyId: addressDefault.receiverCountyId,
  1224. receiverTown: addressDefault.receiverTown, // 镇
  1225. receiverTownId: addressDefault.receiverTownId,
  1226. receiverAddress: addressDefault.receiverAddress, // 详细地址
  1227. receiverZipcode: addressDefault.receiverZipcode, // 邮编
  1228. isDefault: addressDefault.isDefault // 是否默认地址
  1229. },
  1230. reqOrderInvoice: {
  1231. reqOrderId: id,
  1232. invoiceId: invoiceInfoDefault.id, // 发票id
  1233. invoiceType: invoiceInfoDefault.invoiceType, // 发票类型
  1234. invoiceContent: invoiceInfoDefault.invoiceContent, // 开票项目
  1235. invoiceTitle: invoiceInfoDefault.invoiceTitle, // 发票抬头
  1236. invoiceTaxId: invoiceInfoDefault.invoiceTaxId, // 纳税人识别码
  1237. invoiceBank: invoiceInfoDefault.invoiceBank, // 开户银行
  1238. invoiceAccount: invoiceInfoDefault.invoiceAccount, // 开户账户
  1239. invoiceSubBank: invoiceInfoDefault.invoiceSubBank // 支行
  1240. },
  1241. reqOrderItems: orderCartData
  1242. };
  1243. return Object.assign({}, postData);
  1244. }
  1245. // showCustfeeDialog() {
  1246. // this.props.dispatch({
  1247. // type: "global/custfeeVisible",
  1248. // payload: true
  1249. // });
  1250. // }
  1251. showInvoiceDialog() {
  1252. this.props.dispatch({
  1253. type: "global/invoiceVisible",
  1254. payload: true
  1255. });
  1256. }
  1257. showModal() {
  1258. const { supplierId } = this.state;
  1259. if (!supplierId) {
  1260. message.info("请先选择供应商!");
  1261. return false;
  1262. }
  1263. this.props.dispatch({
  1264. type: "global/treeListVisible",
  1265. payload: true
  1266. });
  1267. }
  1268. addGoodsInfo(treeListSelectedRows) {
  1269. const { orderCartData, dispatch } = this.props;
  1270. let newOrderCartData = [];
  1271. if (typeof orderCartData == "object") {
  1272. newOrderCartData = orderCartData.concat([]);
  1273. }
  1274. // 判断添加的商品是否重复 todo...
  1275. treeListSelectedRows.forEach(addRow => {
  1276. let repeat = false;
  1277. const conversionRate = parseFloat(addRow.conversionRate || "1");
  1278. newOrderCartData.forEach(item => {
  1279. // 重复,则累加订货数量、主数量
  1280. if (item.goodsId == addRow.id && item.ext05 == addRow.ext05) {
  1281. item.orderNum += 1;
  1282. item.mainNum += conversionRate;
  1283. repeat = true;
  1284. }
  1285. });
  1286. if (!repeat) {
  1287. const newAddRow = Object.assign({}, addRow);
  1288. newAddRow.orderNum = 1;
  1289. newAddRow.mainNum = conversionRate;
  1290. const newAddRows = setItemsDefaultData([newAddRow], true);
  1291. newOrderCartData = newOrderCartData.concat(newAddRows);
  1292. }
  1293. });
  1294. dispatch({
  1295. type: "orderEdit/orderCartData",
  1296. orderCartData: newOrderCartData
  1297. });
  1298. // 匹配促销信息
  1299. this.ifPromotion = true;
  1300. // 重新补充BOM信息
  1301. this.ifFillBom = true;
  1302. }
  1303. // setModalResultVisible = (modalResultVisible) => {
  1304. // this.setState({ modalResultVisible });
  1305. // }
  1306. render() {
  1307. const {
  1308. btnTxt,
  1309. iconType,
  1310. isShow,
  1311. totalAmount,
  1312. totalDealAmount,
  1313. promAmount,
  1314. totalWeight,
  1315. totalVolume,
  1316. invoiceInfoData,
  1317. supplierId,
  1318. transportModeId,
  1319. settleModeId,
  1320. underPaymentModeId,
  1321. underPaymentModeCode,
  1322. underPaymentModeName,
  1323. supplierDisabled,
  1324. ifCashOrder,
  1325. occupyMnyTopLimit,
  1326. ifOneSupplier,
  1327. modalResultVisible,
  1328. actionType
  1329. } = this.state;
  1330. const {
  1331. logisticsData,
  1332. settlementData,
  1333. payforMainData,
  1334. orderCartData,
  1335. orderCredit,
  1336. supplierData,
  1337. promotionInfoData,
  1338. accountPeriodInfo
  1339. } = this.props;
  1340. if (payforMainData && payforMainData.length && this.state.underPaymentModeId == "") {
  1341. for (var i = 0; i < payforMainData.length; i++) {
  1342. if (payforMainData[i].code == "GoodsFirst") {
  1343. this.setState({ underPaymentModeId: payforMainData[i].id });
  1344. }
  1345. }
  1346. }
  1347. const currOrderMaxOccMny = getMaxOccupyMny(
  1348. occupyMnyTopLimit,
  1349. totalAmount,
  1350. totalAmount - promAmount
  1351. );
  1352. let addressData = this.state.addressData;
  1353. addressData = Array.isArray(addressData)
  1354. ? addressData
  1355. : Object.values(addressData);
  1356. // 收货地址
  1357. const addressHtml = () => {
  1358. if (!addressData) return null;
  1359. const htmlArr = [];
  1360. let defaultHtml;
  1361. for (let i = 0; i < addressData.length; i++) {
  1362. const index = i;
  1363. if (!addressData[i].receiverPhone) addressData[i].receiverPhone = "";
  1364. if (addressData[i].isSelected == 1) {
  1365. defaultHtml = (
  1366. <li className={styles.addressItem} key={addressData[i].id}>
  1367. <span
  1368. className={styles.name}
  1369. style={{ border: "2px solid #E14C46" }}
  1370. >
  1371. {addressData[i].receiver}
  1372. </span>
  1373. <div className={styles.infoBox}>
  1374. <span className={styles.addressTxt}>
  1375. {addressData[i].receiverProvince}{" "}
  1376. {addressData[i].receiverCity}{" "}
  1377. {addressData[i].receiverCounty}{" "}
  1378. {addressData[i].receiverTown} {addressData[i].receiverAddress}
  1379. </span>
  1380. <span className={styles.phoneNumber}>
  1381. {addressData[i].receiverPhone ? addressData[i].receiverPhone.substr(0, 3) + "****" + addressData[i].receiverPhone.substring(7, 11) : ""}
  1382. </span>
  1383. <span
  1384. style={{
  1385. display:
  1386. addressData[i].isDefault == 1 ? "inline-block" : "none"
  1387. }}
  1388. className={styles.defaultBtn}
  1389. >
  1390. 默认地址
  1391. </span>
  1392. <span
  1393. className={
  1394. addressData[i].isDefault == 1
  1395. ? styles.defaultAdr
  1396. : styles.setDefault
  1397. }
  1398. onClick={this.setDefaultHandle.bind(this, index)}
  1399. >
  1400. 设为默认
  1401. </span>
  1402. </div>
  1403. </li>
  1404. );
  1405. } else {
  1406. const html = (
  1407. <li
  1408. className={styles.addressItem}
  1409. key={addressData[i].id}
  1410. style={{ display: isShow ? "block" : "none" }}
  1411. >
  1412. <span
  1413. className={styles.name}
  1414. onClick={this.selectAddressHandle.bind(this, index)}
  1415. >
  1416. {addressData[i].receiver}
  1417. </span>
  1418. <div className={styles.infoBox}>
  1419. <span className={styles.addressTxt}>
  1420. {addressData[i].receiverProvince}{" "}
  1421. {addressData[i].receiverCity}{" "}
  1422. {addressData[i].receiverCounty}{" "}
  1423. {addressData[i].receiverTown} {addressData[i].receiverAddress}
  1424. </span>
  1425. <span className={styles.phoneNumber}>
  1426. {addressData[i].receiverPhone ? addressData[i].receiverPhone.substr(0, 3) + "****" + addressData[i].receiverPhone.substring(7, 11) : ""}
  1427. </span>
  1428. <span
  1429. style={{
  1430. display:
  1431. addressData[i].isDefault == 1 ? "inline-block" : "none"
  1432. }}
  1433. className={styles.defaultBtn}
  1434. >
  1435. 默认地址
  1436. </span>
  1437. <span
  1438. className={
  1439. addressData[i].isDefault == 1
  1440. ? styles.defaultAdr
  1441. : styles.setDefault
  1442. }
  1443. onClick={this.setDefaultHandle.bind(this, index)}
  1444. >
  1445. 设为默认
  1446. </span>
  1447. </div>
  1448. </li>
  1449. );
  1450. htmlArr.push(html);
  1451. }
  1452. }
  1453. htmlArr.unshift(defaultHtml);
  1454. return htmlArr;
  1455. };
  1456. // 拼接下拉框选项
  1457. const selectOptionHtml = listData => {
  1458. if (!listData || listData.length < 1) return null;
  1459. const optionHtmls = listData.map(item => (
  1460. <Select.Option key={item.id} value={item.id}>
  1461. {item.name}
  1462. </Select.Option>
  1463. ));
  1464. return optionHtmls;
  1465. };
  1466. // 发票信息
  1467. const invoiceInfoHtml = () => {
  1468. if (!invoiceInfoData) return null;
  1469. const invoiceInfo = invoiceInfoData.find(item => item.isDefault == 1);
  1470. let html;
  1471. if (!invoiceInfo) {
  1472. html = (
  1473. <Row className={styles.invoiceInfo}>
  1474. <Col span={2}/>
  1475. <Col span={4}/>
  1476. <Col span={2} className={styles.taxpayersNum}>
  1477. 纳税人识别号:
  1478. </Col>
  1479. <Col span={4}/>
  1480. <Col span={2} className={styles.bank}>
  1481. 开户行:
  1482. </Col>
  1483. <Col span={4}/>
  1484. <Col span={1} className={styles.account}>
  1485. 账号:
  1486. </Col>
  1487. <Col span={4}/>
  1488. <Col span={1}>
  1489. <span
  1490. className={styles.selectBtn}
  1491. onClick={this.showInvoiceDialog.bind(this)}
  1492. >
  1493. 选择
  1494. </span>
  1495. </Col>
  1496. </Row>
  1497. );
  1498. } else {
  1499. html = (
  1500. <Row className={styles.invoiceInfo}>
  1501. <Col span={2}>{invoiceInfo.invoiceType}</Col>
  1502. <Col span={4} title={invoiceInfo.invoiceTitle}>
  1503. {invoiceInfo.invoiceTitle}
  1504. </Col>
  1505. <Col span={2} className={styles.taxpayersNum}>
  1506. 纳税人识别号:
  1507. </Col>
  1508. <Col span={4} title={invoiceInfo.invoiceTaxId}>
  1509. <em>{invoiceInfo.invoiceTaxId}</em>
  1510. </Col>
  1511. <Col span={2} className={styles.bank}>
  1512. 开户行:
  1513. </Col>
  1514. <Col span={4} title={invoiceInfo.invoiceBank}>
  1515. <em>{invoiceInfo.invoiceBank}</em>
  1516. </Col>
  1517. <Col span={1} className={styles.account}>
  1518. 账号:
  1519. </Col>
  1520. <Col span={4} title={invoiceInfo.invoiceAccount}>
  1521. <em>{invoiceInfo.invoiceAccount}</em>
  1522. </Col>
  1523. <Col span={1}>
  1524. <span
  1525. className={styles.selectBtn}
  1526. onClick={this.showInvoiceDialog.bind(this)}
  1527. >
  1528. 选择
  1529. </span>
  1530. </Col>
  1531. </Row>
  1532. );
  1533. }
  1534. return html;
  1535. };
  1536. // 信用查询
  1537. const content = () => {
  1538. if (!orderCredit) return null;
  1539. const creditData = orderCredit.creditData;
  1540. if (!creditData || creditData.length < 1) {
  1541. return (
  1542. <div className={styles.infoSearchCon}>
  1543. 未匹配到信用
  1544. </div>
  1545. );
  1546. }
  1547. return (
  1548. <div className={styles.infoSearchCon}>
  1549. <Layout>
  1550. <Header>本单信用满足情况</Header>
  1551. <Content>
  1552. {creditData.map(item => {
  1553. return (
  1554. <Row key={item.id}>
  1555. <Col span={4}>{item.productLineName}</Col>
  1556. <Col span={6}>信用余额:</Col>
  1557. <Col span={4}>
  1558. {parseFloat(item.creditBalance || 0).toFixed(currency.currencyAmountScale)}
  1559. </Col>
  1560. <Col span={6}>本单产品线金额:</Col>
  1561. <Col span={4}>{parseFloat(item.thisProdLineAmount || 0)
  1562. .toFixed(currency.currencyAmountScale)}
  1563. </Col>
  1564. </Row>
  1565. );
  1566. })}
  1567. </Content>
  1568. </Layout>
  1569. </div>
  1570. );
  1571. };
  1572. const disabledDate = current => {
  1573. return current && current.valueOf() <= Date.now() - 86400000;
  1574. };
  1575. return (
  1576. <div className={styles.orderEidtBox}>
  1577. {/* <BreadcrumbPackage additems={BreadcrumbPaths} /> */}
  1578. <Spin spinning={this.state.loading}>
  1579. <div className={styles.supplierBox}>
  1580. <span className={styles.name}>
  1581. {supplierDisabled ? "供应商" : "请选择供应商"}
  1582. </span>
  1583. <Select
  1584. className={styles.supplierSelect}
  1585. value={supplierId}
  1586. disabled={supplierDisabled}
  1587. onChange={this.supplierChange.bind(this)}
  1588. >
  1589. {selectOptionHtml(supplierData)}
  1590. </Select>
  1591. </div>
  1592. {/* 订单信息 */}
  1593. <div className={styles.orderInfoBox}>
  1594. {/* 收货地址 */}
  1595. <div className={styles.consigneeInfo}>
  1596. <p className={styles.consigneeInfoTxt}>收货人信息</p>
  1597. <div className={styles.addressListBox}>
  1598. <div className={styles.scrollbar}>
  1599. <ul className={styles.addressList}>{addressHtml()}</ul>
  1600. </div>
  1601. </div>
  1602. <span
  1603. className={styles.showBtn}
  1604. onClick={this.showAddressClick.bind(this)}
  1605. >
  1606. {btnTxt}
  1607. <Icon type={`${iconType}`} className={styles.icon}/>
  1608. </span>
  1609. </div>
  1610. {/* 收货地址-- 结束 */}
  1611. {/* 物流结算方式 */}
  1612. <div className={styles.logisticsSettlement}>
  1613. <p className={styles.logisticsSettlementTxt}>物流结算</p>
  1614. <div className={styles.logistics}>
  1615. <div className={styles.logisticsItem}>
  1616. <span className={styles.name}>运输方式</span>
  1617. <Select
  1618. className={styles.selectBox}
  1619. value={transportModeId}
  1620. onChange={this.logisticsChange.bind(this)}
  1621. >
  1622. {selectOptionHtml(logisticsData)}
  1623. </Select>
  1624. </div>
  1625. {/* <div className={styles.logisticsItem}>
  1626. <span className={styles.name}>结算方式</span>
  1627. <Select
  1628. className={styles.selectBox}
  1629. value={settleModeId}
  1630. onChange={this.settlementChange.bind(this)}
  1631. >
  1632. {selectOptionHtml(settlementData)}
  1633. </Select>
  1634. </div>
  1635. <div className={styles.logisticsItem}>
  1636. <span className={styles.name}>支付方式</span>
  1637. <Select
  1638. className={styles.selectBox}
  1639. value={underPaymentModeId}
  1640. onChange={this.payforMainChange.bind(this)}
  1641. >
  1642. {selectOptionHtml(payforMainData)}
  1643. </Select>
  1644. </div>
  1645. <div className={styles.logisticsItem}>
  1646. <span className={styles.name}>账期</span>
  1647. <span className={styles.accountCheck}>
  1648. {accountPeriodInfo ? accountPeriodInfo.name : ""}
  1649. </span>
  1650. </div> */}
  1651. </div>
  1652. </div>
  1653. {/* 物流结算方式 */}
  1654. {/* 发票信息 */}
  1655. <div className={styles.logisticsSettlement}>
  1656. <p className={styles.logisticsSettlementTxt}>发票信息</p>
  1657. <div className={styles.logistics}>{invoiceInfoHtml()}</div>
  1658. </div>
  1659. {/* 发票信息--end */}
  1660. {/* 期望到货日期 */}
  1661. <div className={styles.logisticsSettlement}>
  1662. <p className={styles.logisticsSettlementTxt}>
  1663. 备注
  1664. </p>
  1665. <div className={styles.arrival}>
  1666. {/* <DatePicker
  1667. className={styles.datePickerBox}
  1668. value={moment(this.state.deliveryDate)}
  1669. disabledDate={disabledDate}
  1670. onChange={this.dateChange.bind(this)}
  1671. /> */}
  1672. <Input
  1673. className={styles.iptBox}
  1674. placeholder="备注说明内容"
  1675. value={this.state.remark}
  1676. onChange={this.remarkChange.bind(this)}
  1677. />
  1678. </div>
  1679. </div>
  1680. {/* 期望到货日期--end */}
  1681. </div>
  1682. {/* 订单信息--结束 */}
  1683. <Button
  1684. style={{ display: ifCashOrder && ifOneSupplier ? "none" : "inline-block" }}
  1685. className={styles.addGoodsBtn}
  1686. onClick={this.showModal.bind(this)}
  1687. >
  1688. <Icon type="plus" className={styles.icon}/>增加商品
  1689. </Button>
  1690. {/* 商品 */}
  1691. <Spin spinning={this.state.goodsLoading}>
  1692. <OrderGoodsList
  1693. promotionInfoData={promotionInfoData}
  1694. orderCartData={orderCartData}
  1695. projectData={this.props.projectData}
  1696. ifEditable={!(ifCashOrder && ifOneSupplier)}
  1697. onChange={this.goodsInfoChange.bind(this)}
  1698. offsetAmount={this.state.offsetAmount}
  1699. promotionChange={this.promotionChangeHandle.bind(this)}
  1700. optClick={this.onOptClick.bind(this)}
  1701. ifOptional={ifOptional}
  1702. ifPromotion={value => {
  1703. this.ifPromotion = value;
  1704. }}
  1705. setGiftItems={items => {
  1706. this.giftItems = items;
  1707. }}
  1708. {...this.props}
  1709. ref={c => {
  1710. this.orderGoodsList = c;
  1711. }}
  1712. />
  1713. </Spin>
  1714. {/* 商品--end */}
  1715. {/* 订单底部信息 */}
  1716. <Affix className={styles.orderGoodsFooter} offsetBottom={0}>
  1717. <div className={styles.orderGoodsTotal}>
  1718. <Row className={styles.row}>
  1719. <Col span={5}>
  1720. <span className={styles.name}>总重量:</span>
  1721. <span className={styles.valueBox}>
  1722. <em>{totalWeight.toFixed(2)}千克</em>
  1723. </span>
  1724. </Col>
  1725. <Col span={5}>
  1726. <div style={{ display: ifCashOrder || !ifOneSupplier ? "none" : "block" }}>
  1727. <span className={styles.name}>商品金额:</span>
  1728. <span className={`${styles.valueBox} ${styles.red}`}>
  1729. ¥{totalAmount.toFixed(2)}
  1730. </span>
  1731. </div>
  1732. <div style={{ display: ifCashOrder || !ifOneSupplier ? "block" : "none" }}>
  1733. <span className={styles.name}>总体积:</span>
  1734. <span className={styles.valueBox}>
  1735. <em>{totalVolume.toFixed(2)}</em>
  1736. </span>
  1737. </div>
  1738. </Col>
  1739. <Col span={9}>
  1740. {/* <div
  1741. className={styles.item}
  1742. style={{ display: ifCashOrder || !ifOneSupplier ? "none" : "block" }}
  1743. >
  1744. <span className={styles.name}>费用冲抵:</span>
  1745. <span className={styles.valueBox}>
  1746. <Input
  1747. className={styles.ipt}
  1748. onChange={this.custfeeChange.bind(this)}
  1749. onBlur={this.custfeeBlur.bind(this)}
  1750. value={this.state.offsetAmount}
  1751. />
  1752. </span>
  1753. <span className={styles.txt}>
  1754. (本次最高冲抵:
  1755. <span style={{ color: "#E14C46" }}>
  1756. ¥{parseFloat(currOrderMaxOccMny || "0")
  1757. .toFixed(currency.currencyAmountScale)}
  1758. </span>
  1759. </span>
  1760. <span className={styles.txt}>
  1761. 费用总余额:
  1762. <span style={{ color: "#E14C46" }}>
  1763. ¥{parseFloat((occupyMnyTopLimit || {}).supplyMaxOccupyMny || "0")
  1764. .toFixed(currency.currencyAmountScale)}
  1765. </span>
  1766. </span>
  1767. </div> */}
  1768. <div
  1769. className={styles.item}
  1770. style={{ display: (!ifCashOrder && !ifOneSupplier) ? "block" : "none" }}
  1771. >
  1772. <span className={styles.name}>促销金额:</span>
  1773. <span className={`${styles.valueBox} ${styles.red}`}>
  1774. ¥{promAmount.toFixed(2)}
  1775. </span>
  1776. </div>
  1777. <div
  1778. className={styles.item}
  1779. style={{ display: ifCashOrder || !ifOneSupplier ? "none" : "block" }}
  1780. >
  1781. <span className={styles.name}>促销金额:</span>
  1782. <span className={`${styles.valueBox} ${styles.red}`}>
  1783. ¥{promAmount.toFixed(2)}
  1784. </span>
  1785. </div>
  1786. <div style={{ display: ifCashOrder || !ifOneSupplier ? "block" : "none" }}>
  1787. <span className={styles.name}>商品金额:</span>
  1788. <span className={`${styles.valueBox} ${styles.red}`}>
  1789. ¥{totalAmount.toFixed(2)}
  1790. </span>
  1791. </div>
  1792. </Col>
  1793. <Col span={5} className={styles.lastCol}>
  1794. <span className={styles.name}>订单总金额:</span>
  1795. <span
  1796. className={styles.valueBox}
  1797. style={{
  1798. fontSize: 24,
  1799. color: "#D81719"
  1800. }}
  1801. >
  1802. ¥{ifCashOrder && ifOneSupplier ? "0.00" : totalDealAmount.toFixed(2)}
  1803. </span>
  1804. </Col>
  1805. </Row>
  1806. <Row className={styles.row}>
  1807. <Col span={4}>
  1808. {/* <div
  1809. className={styles.item}
  1810. style={{ display: (!ifCashOrder && !ifOneSupplier) ? "block" : "none" }}
  1811. >
  1812. <span className={styles.name}>促销金额:</span>
  1813. <span className={`${styles.valueBox} ${styles.red}`}>
  1814. ¥{promAmount.toFixed(currency.currencyAmountScale)}
  1815. </span>
  1816. </div> */}
  1817. {/* <div style={{ display: ifCashOrder || !ifOneSupplier ? "none" : "block" }}>
  1818. <span className={styles.name}>总体积:</span>
  1819. <span className={styles.valueBox}>
  1820. <em>{totalVolume.toFixed(4)}</em>
  1821. </span>
  1822. </div> */}
  1823. </Col>
  1824. <Col span={4}>
  1825. {/* <div
  1826. className={styles.item}
  1827. style={{ display: ifCashOrder || !ifOneSupplier ? "none" : "block" }}
  1828. >
  1829. <span className={styles.name}>促销金额:</span>
  1830. <span className={`${styles.valueBox} ${styles.red}`}>
  1831. ¥{promAmount.toFixed(currency.currencyAmountScale)}
  1832. </span>
  1833. </div> */}
  1834. </Col>
  1835. <Col span={6}>
  1836. {/* <span
  1837. className={styles.infoSearch}
  1838. style={{ display: ifCashOrder || !ifOneSupplier ? "none" : "inline-block" }}
  1839. >
  1840. 信用查询
  1841. <Popover
  1842. content={content()}
  1843. title={null}
  1844. trigger="hover"
  1845. style={{ width: 500 }}
  1846. >
  1847. <Icon type="question-circle" className={styles.icon}/>
  1848. </Popover>
  1849. </span> */}
  1850. </Col>
  1851. <Col span={10} className={styles.lastCol}>
  1852. <div className={styles.btnBox}>
  1853. <div className={styles.cancelBtn}>
  1854. <Popconfirm
  1855. title="是否确定取消?"
  1856. onConfirm={this.cancelHandle.bind(this)}
  1857. >
  1858. <Button className={styles.btn}>取消</Button>
  1859. </Popconfirm>
  1860. <Button
  1861. style={{
  1862. display: ifCashOrder && ifOneSupplier ? "none" : "inline-block"
  1863. }}
  1864. className={styles.btn}
  1865. onClick={this.saveTempHandle.bind(this)}
  1866. disabled={this.state.isDisabled}
  1867. >
  1868. 暂存
  1869. </Button>
  1870. <Button
  1871. className={styles.btn}
  1872. onClick={this.okHandle.bind(this)}
  1873. >
  1874. 提交
  1875. </Button>
  1876. </div>
  1877. </div>
  1878. </Col>
  1879. </Row>
  1880. </div>
  1881. </Affix>
  1882. {/* 订单底部信息--end */}
  1883. <TreeListModal
  1884. ref={ref => (this.state.ref.treeListModal = ref)}
  1885. title="请选择商品"
  1886. supplierId={this.state.supplierId}
  1887. treeUrl="/buyer/goods-category/tree"
  1888. listUrl="/b2b/goods/find-by-customer"
  1889. saleModel="01"
  1890. onConfirm={this.addGoodsInfo.bind(this)}
  1891. />
  1892. <InvoiceDialog invoiceInfoData={invoiceInfoData}/>
  1893. </Spin>
  1894. <FormPayforDialog
  1895. payNeedData={this.state.payNeedData}
  1896. orderPayBillSet={this.props.orderPayBillSet}
  1897. backToWho="orderList"
  1898. />
  1899. <Modal title="颜色选择" visible={this.state.optValShow}
  1900. onCancel={() => {
  1901. this.setState({optValShow: false})
  1902. }}
  1903. onOk={async () => {
  1904. if (this.state.optValSelectId) {
  1905. const colorSelc = this.state.goodsAttrVals ? this.state.goodsAttrVals.find(item => item.attrValId == this.state.optValSelectId) : null
  1906. const optVal = Object.assign({},this.state.optVal,colorSelc,{baseGoodsOptValue: `${colorSelc.custDocGroupName}->${colorSelc.attrValName}`})
  1907. this.setState({
  1908. optVal ,
  1909. optValShow: false,
  1910. goodsAttrVals: []
  1911. })
  1912. this.confirmColor(optVal)
  1913. } else {
  1914. message.warning("请选择颜色")
  1915. }
  1916. }}
  1917. width="1000px" maskClosable={false}
  1918. >
  1919. <div>
  1920. <Input.Search placeholder="请输入颜色编码"
  1921. // defaultValue={this.state.optSearchVal}
  1922. onBlur={(e) => {
  1923. this.setState({optSearchVal: e.target.value})
  1924. }}
  1925. onSearch={(e) => {
  1926. this.setState({optSearchVal: e})
  1927. }}
  1928. onPressEnter={(e) => {
  1929. this.setState({optSearchVal: e.target.value})
  1930. }}
  1931. />
  1932. </div>
  1933. <div style={{height: "500px",width: "950px",overflow: "auto", marginTop: "10px"}}>
  1934. {
  1935. this.state.goodsAttrVals ? this.state.goodsAttrVals.filter(item => !this.state.optSearchVal || item.attrValName.indexOf(this.state.optSearchVal) >= 0).map((item,index) => {
  1936. // return <Tag color={this.state.optValSelectId == item.attrValName ? "red" : ""} className={styles.colorItem} onClick={this.selectColor.bind(this)}>{item.attrValName}</Tag>
  1937. return <Tag key={item.attrValId} color={this.state.optValSelectId == item.attrValId ? "red" : ""} className={styles.colorItem} onClick={() => {this.selectColor(item.attrValId)}}>{item.attrValName}</Tag>
  1938. }) : ""
  1939. }
  1940. </div>
  1941. </Modal>
  1942. </div>
  1943. );
  1944. }
  1945. }
  1946. export default connect(state => ({
  1947. supplierData: state.orderEdit.supplierData,
  1948. addressData: state.orderEdit.addressData,
  1949. logisticsData: state.orderEdit.logisticsData,
  1950. settlementData: state.orderEdit.settlementData,
  1951. payforMainData: state.orderEdit.payforMainData,
  1952. invoiceInfoData: state.orderEdit.invoiceInfoData,
  1953. orderCartData: state.orderEdit.orderCartData,
  1954. resultOrder: state.orderEdit.resultOrder,
  1955. // orderCustfeeData: state.orderEdit.orderCustfeeData,
  1956. promotionInfoData: state.orderEdit.promotionInfoData,
  1957. occupyMnyTopLimits: state.orderEdit.occupyMnyTopLimits,
  1958. orderCredit: state.orderEdit.orderCredit,
  1959. orderEditData: state.orderEdit.orderEditData,
  1960. cartListData: state.cartList.cartListData,
  1961. projectData: state.orderEdit.projectData,
  1962. orderPayBillSet: state.paymentNotice.orderPayBillSet,
  1963. accountPeriodInfo: state.orderEdit.accountPeriodInfo
  1964. // treeListSelectedRows: state.global.selectedRows
  1965. }))(OrderEidt);