kmkf-work-order-service-component 0.1.12 → 0.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -786,23 +786,23 @@ export var orderBack = /*#__PURE__*/function () {
786
786
  enterprisePaymentTid: order_no
787
787
  });
788
788
  }
789
- }
789
+ } // console.log('detailsValue++', formValue, detailsValue);
790
+
790
791
 
791
- console.log('detailsValue++', formValue, detailsValue);
792
792
  form.setFieldsValue(_objectSpread(_objectSpread({}, formValue), detailsValue));
793
- _context.next = 31;
793
+ _context.next = 30;
794
794
  break;
795
795
 
796
- case 29:
797
- _context.prev = 29;
796
+ case 28:
797
+ _context.prev = 28;
798
798
  _context.t0 = _context["catch"](2);
799
799
 
800
- case 31:
800
+ case 30:
801
801
  case "end":
802
802
  return _context.stop();
803
803
  }
804
804
  }
805
- }, _callee, null, [[2, 29]]);
805
+ }, _callee, null, [[2, 28]]);
806
806
  }));
807
807
 
808
808
  return function orderBack(_x) {
@@ -877,7 +877,9 @@ var getComponentsValue = function getComponentsValue() {
877
877
  ITEM_SELECT: 'itemList',
878
878
  REMARK_INPUT: 'remark',
879
879
  ITEM_ID: 'goodId',
880
- ITEM_ENCODE: 'goodSerial'
880
+ ITEM_ENCODE: 'goodSerial',
881
+ BUYER_NICK_INPUT: 'buyer',
882
+ ENTERPRISE_PAYMENT: 'payBuyer'
881
883
  };
882
884
  return list.reduce(function (prv, next) {
883
885
  if (mapList[next.workOrderComponentType]) {
@@ -104,7 +104,7 @@ var CustomizeFormModal = function CustomizeFormModal(props, ref) {
104
104
 
105
105
  var asyncDoSave = /*#__PURE__*/function () {
106
106
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(workOrderDetail, templateDetail) {
107
- var data, params, submitData, _yield$updateWorkOrde, success, result, _params, hasEnterPrisePayment, getEnterPrisePaymentData, uniqueKey, componentConfig, _yield$addWorkOrder, _success, _result;
107
+ var data, res, params, submitData, _yield$updateWorkOrde, success, result, _params, hasEnterPrisePayment, getEnterPrisePaymentData, uniqueKey, componentConfig, _yield$addWorkOrder, _success, _result;
108
108
 
109
109
  return _regeneratorRuntime().wrap(function _callee$(_context) {
110
110
  while (1) {
@@ -119,9 +119,19 @@ var CustomizeFormModal = function CustomizeFormModal(props, ref) {
119
119
  data = _context.sent;
120
120
  console.debug('表单内容', data);
121
121
  console.debug('templateDetail内容', templateDetail);
122
+ res = verifyHandle(data, templateDetail);
122
123
 
124
+ if (res.success) {
125
+ _context.next = 11;
126
+ break;
127
+ }
128
+
129
+ message.error(res.message);
130
+ return _context.abrupt("return");
131
+
132
+ case 11:
123
133
  if (!workOrderId) {
124
- _context.next = 19;
134
+ _context.next = 23;
125
135
  break;
126
136
  }
127
137
 
@@ -141,10 +151,10 @@ var CustomizeFormModal = function CustomizeFormModal(props, ref) {
141
151
  params.workOrderUpdateKeyVos.workOrderUpdateKeySupVos = submitData.reduce(function (nex, cur) {
142
152
  return nex.concat(cur === null || cur === void 0 ? void 0 : cur.contentVoList);
143
153
  }, []);
144
- _context.next = 13;
154
+ _context.next = 17;
145
155
  return updateWorkOrder(params);
146
156
 
147
- case 13:
157
+ case 17:
148
158
  _yield$updateWorkOrde = _context.sent;
149
159
  success = _yield$updateWorkOrde.success;
150
160
  result = _yield$updateWorkOrde.data;
@@ -160,10 +170,10 @@ var CustomizeFormModal = function CustomizeFormModal(props, ref) {
160
170
  });
161
171
  }
162
172
 
163
- _context.next = 31;
173
+ _context.next = 35;
164
174
  break;
165
175
 
166
- case 19:
176
+ case 23:
167
177
  _params = {
168
178
  apiName: 'addWorkOrder',
169
179
  shopId: currentShopId,
@@ -199,10 +209,10 @@ var CustomizeFormModal = function CustomizeFormModal(props, ref) {
199
209
 
200
210
  console.debug('增加数据参数', _params); // return;
201
211
 
202
- _context.next = 27;
212
+ _context.next = 31;
203
213
  return addWorkOrder(_params);
204
214
 
205
- case 27:
215
+ case 31:
206
216
  _yield$addWorkOrder = _context.sent;
207
217
  _success = _yield$addWorkOrder.success;
208
218
  _result = _yield$addWorkOrder.data;
@@ -217,13 +227,13 @@ var CustomizeFormModal = function CustomizeFormModal(props, ref) {
217
227
  });
218
228
  }
219
229
 
220
- case 31:
230
+ case 35:
221
231
  console.groupEnd();
222
- _context.next = 37;
232
+ _context.next = 41;
223
233
  break;
224
234
 
225
- case 34:
226
- _context.prev = 34;
235
+ case 38:
236
+ _context.prev = 38;
227
237
  _context.t0 = _context["catch"](0);
228
238
 
229
239
  // 表单校验失败错误时,将错误第一项滚动到可视区域
@@ -239,18 +249,41 @@ var CustomizeFormModal = function CustomizeFormModal(props, ref) {
239
249
  }, 0);
240
250
  }
241
251
 
242
- case 37:
252
+ case 41:
243
253
  case "end":
244
254
  return _context.stop();
245
255
  }
246
256
  }
247
- }, _callee, null, [[0, 34]]);
257
+ }, _callee, null, [[0, 38]]);
248
258
  }));
249
259
 
250
260
  return function asyncDoSave(_x, _x2) {
251
261
  return _ref.apply(this, arguments);
252
262
  };
253
- }();
263
+ }(); //表单额外校验
264
+
265
+
266
+ var verifyHandle = function verifyHandle(data, templateDetail) {
267
+ var _templateDetail$compo, _templateDetail$compo2, _data$paymentUniqueKe, _data$paymentUniqueKe2;
268
+
269
+ var res = {
270
+ success: true,
271
+ message: ''
272
+ };
273
+ var tradeIdUniqueKey = (_templateDetail$compo = templateDetail.componentDtoList.find(function (item) {
274
+ return item.workOrderComponentType === 'TRADE_ID_INPUT';
275
+ })) === null || _templateDetail$compo === void 0 ? void 0 : _templateDetail$compo.uniqueKey;
276
+ var paymentUniqueKey = (_templateDetail$compo2 = templateDetail.componentDtoList.find(function (item) {
277
+ return item.workOrderComponentType === 'ENTERPRISE_PAYMENT';
278
+ })) === null || _templateDetail$compo2 === void 0 ? void 0 : _templateDetail$compo2.uniqueKey;
279
+
280
+ if (tradeIdUniqueKey && paymentUniqueKey && data[tradeIdUniqueKey] && (_data$paymentUniqueKe = data[paymentUniqueKey]) !== null && _data$paymentUniqueKe !== void 0 && _data$paymentUniqueKe.enterprisePaymentTid && data[tradeIdUniqueKey] != ((_data$paymentUniqueKe2 = data[paymentUniqueKey]) === null || _data$paymentUniqueKe2 === void 0 ? void 0 : _data$paymentUniqueKe2.enterprisePaymentTid)) {
281
+ res.success = false;
282
+ res.message = '订单组件和打款组件的订单号必须一致';
283
+ }
284
+
285
+ return res;
286
+ };
254
287
 
255
288
  var handleSubmit = useCallback(function () {
256
289
  return asyncDoSave(workOrderDetail, templateDetail);
@@ -30,11 +30,12 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
30
30
 
31
31
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
32
32
 
33
- import React, { useState, useImperativeHandle, forwardRef } from 'react';
33
+ import React, { useState, useImperativeHandle, forwardRef, useRef } from 'react';
34
34
  import { Drawer, Form, Spin, Input, Space, Button, message } from 'antd';
35
35
  import { LeftOutlined } from '@ant-design/icons';
36
36
  import { get } from 'lodash';
37
- import { decodeAlipayInfo, editRemitOrder, addPaymentOrder } from "../../model/servers/api";
37
+ import { decodeAlipayInfo, editRemitOrder, addPaymentOrder, getThirdOpenUidByOrderNo } from "../../model/servers/api";
38
+ import { useAppSelector } from "../../model/hooks";
38
39
  import { jsx as _jsx } from "react/jsx-runtime";
39
40
  import { jsxs as _jsxs } from "react/jsx-runtime";
40
41
 
@@ -57,6 +58,9 @@ function ModifyModal(props, ref) {
57
58
  }
58
59
  };
59
60
  });
61
+ var platformInfo = useAppSelector(function (state) {
62
+ return state.global.platformInfo;
63
+ });
60
64
 
61
65
  var _useState = useState(false),
62
66
  _useState2 = _slicedToArray(_useState, 2),
@@ -92,6 +96,8 @@ function ModifyModal(props, ref) {
92
96
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
93
97
  form = _Form$useForm2[0];
94
98
 
99
+ var time = useRef(null);
100
+
95
101
  var handleOk = function handleOk() {
96
102
  form.validateFields().then( /*#__PURE__*/function () {
97
103
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(values) {
@@ -218,8 +224,61 @@ function ModifyModal(props, ref) {
218
224
  }();
219
225
 
220
226
  var TidChangeHandle = function TidChangeHandle(e) {
221
- console.log(e.target.value);
222
- };
227
+ var _shopList$find2;
228
+
229
+ var order_no = e.target.value;
230
+ var taobaoId = (_shopList$find2 = shopList.find(function (item) {
231
+ return item.shopSourceStr === 'TAOBAO' && item.shopId == platformInfo.shopId;
232
+ })) === null || _shopList$find2 === void 0 ? void 0 : _shopList$find2.taobaoId; //淘宝订单买家id返填
233
+
234
+ if (taobaoId) {
235
+ clearTimeout(time.current);
236
+ time.current = setTimeout(function () {
237
+ getThirdUid(order_no, taobaoId);
238
+ }, 1000);
239
+ }
240
+ }; //获取买家信息
241
+
242
+
243
+ var getThirdUid = /*#__PURE__*/function () {
244
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(order_no, taobaoId) {
245
+ var buyer, buyerInfo;
246
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
247
+ while (1) {
248
+ switch (_context3.prev = _context3.next) {
249
+ case 0:
250
+ _context3.prev = 0;
251
+ _context3.next = 3;
252
+ return getThirdOpenUidByOrderNo({
253
+ orderNo: order_no,
254
+ toAppKey: '21819818',
255
+ platform: 'tb',
256
+ taobaoId: taobaoId
257
+ });
258
+
259
+ case 3:
260
+ buyer = _context3.sent;
261
+ buyerInfo = buyer === null || buyer === void 0 ? void 0 : buyer.data;
262
+ form.setFieldsValue(_objectSpread({}, buyerInfo || {}));
263
+ _context3.next = 10;
264
+ break;
265
+
266
+ case 8:
267
+ _context3.prev = 8;
268
+ _context3.t0 = _context3["catch"](0);
269
+
270
+ case 10:
271
+ case "end":
272
+ return _context3.stop();
273
+ }
274
+ }
275
+ }, _callee3, null, [[0, 8]]);
276
+ }));
277
+
278
+ return function getThirdUid(_x3, _x4) {
279
+ return _ref3.apply(this, arguments);
280
+ };
281
+ }();
223
282
 
224
283
  return /*#__PURE__*/_jsx(Drawer, {
225
284
  closeIcon: /*#__PURE__*/_jsx(LeftOutlined, {}),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kmkf-work-order-service-component",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",