You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
NewEduCoderBuild/p__User__Detail__Order__pag...

412 lines
19 KiB

"use strict";
(self["webpackChunk"] = self["webpackChunk"] || []).push([[556],{
/***/ 73208:
/*!*****************************************!*\
!*** ./src/components/NoData/index.tsx ***!
\*****************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectSpread2.js */ 26801);
/* harmony import */ var _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ 59301);
/* harmony import */ var _assets_images_icons_nodata_png__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @/assets/images/icons/nodata.png */ 93314);
/* harmony import */ var antd__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! antd */ 3113);
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react/jsx-runtime */ 37712);
var noData = function noData(_ref) {
var img = _ref.img,
_ref$buttonProps = _ref.buttonProps,
buttonProps = _ref$buttonProps === void 0 ? {} : _ref$buttonProps,
_ref$styles = _ref.styles,
styles = _ref$styles === void 0 ? {} : _ref$styles,
customText = _ref.customText,
ButtonText = _ref.ButtonText,
ButtonClick = _ref.ButtonClick,
Buttonclass = _ref.Buttonclass,
ButtonTwo = _ref.ButtonTwo,
imgStyles = _ref.imgStyles,
_ref$loading = _ref.loading,
loading = _ref$loading === void 0 ? false : _ref$loading;
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("section", {
className: "tc animated fadeIn",
style: _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, {
color: '#999',
margin: '100px auto',
visibility: loading ? 'hidden' : 'visible'
}), styles),
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("img", {
src: img || _assets_images_icons_nodata_png__WEBPACK_IMPORTED_MODULE_2__,
style: _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({}, imgStyles)
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("p", {
className: "mt20 font14",
children: customText || '暂时还没有相关数据哦!'
}), ButtonText && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(antd__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .ZP, _root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()(_root_workspace_ppte5yg23_local_v9_test1_node_modules_babel_runtime_7_23_2_babel_runtime_helpers_objectSpread2_js__WEBPACK_IMPORTED_MODULE_0___default()({
className: Buttonclass,
onClick: ButtonClick
}, buttonProps), {}, {
children: ButtonText
})), ButtonTwo && ButtonTwo]
});
};
/* harmony default export */ __webpack_exports__.Z = (noData);
/***/ }),
/***/ 60992:
/*!*************************************************************************!*\
!*** ./src/pages/User/Detail/Order/pages/invoice/index.tsx + 1 modules ***!
\*************************************************************************/
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": function() { return /* binding */ invoice; }
});
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/toConsumableArray.js
var toConsumableArray = __webpack_require__(93923);
var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/regeneratorRuntime.js
var regeneratorRuntime = __webpack_require__(10574);
var regeneratorRuntime_default = /*#__PURE__*/__webpack_require__.n(regeneratorRuntime);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/asyncToGenerator.js
var asyncToGenerator = __webpack_require__(39343);
var asyncToGenerator_default = /*#__PURE__*/__webpack_require__.n(asyncToGenerator);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/slicedToArray.js
var slicedToArray = __webpack_require__(11006);
var slicedToArray_default = /*#__PURE__*/__webpack_require__.n(slicedToArray);
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectWithoutProperties.js
var objectWithoutProperties = __webpack_require__(27161);
var objectWithoutProperties_default = /*#__PURE__*/__webpack_require__.n(objectWithoutProperties);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/index.js
var _react_17_0_2_react = __webpack_require__(59301);
// EXTERNAL MODULE: ./src/.umi-production/exports.ts
var _umi_production_exports = __webpack_require__(45295);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/checkbox/index.js + 3 modules
var es_checkbox = __webpack_require__(24905);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/message/index.js + 4 modules
var message = __webpack_require__(8591);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/skeleton/index.js + 12 modules
var skeleton = __webpack_require__(59981);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/empty/index.js + 3 modules
var empty = __webpack_require__(64165);
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/row/index.js
var row = __webpack_require__(95237);
// EXTERNAL MODULE: ./src/utils/fetch.ts
var fetch = __webpack_require__(91506);
// EXTERNAL MODULE: ./src/utils/util.tsx
var util = __webpack_require__(22739);
;// CONCATENATED MODULE: ./src/pages/User/Detail/Order/pages/invoice/index.less?modules
// extracted by mini-css-extract-plugin
/* harmony default export */ var invoicemodules = ({"flex_box_center":"flex_box_center___S4_65","flex_space_between":"flex_space_between___CzNk6","flex_box_vertical_center":"flex_box_vertical_center___vt2bo","flex_box_center_end":"flex_box_center_end___sWapv","flex_box_column":"flex_box_column___mw9mU","invoice":"invoice___a84xn","title":"title___GZTtr","content":"content___RYPcg","w1":"w1___oSVo6","w2":"w2___iJBuO","w3":"w3___aBBd0","w4":"w4___AAR4n","w5":"w5___pi5Ju","w6":"w6___tI151","w7":"w7___jFo0v","listTitle":"listTitle___Sgp7V","listContent":"listContent___E6QJQ","checkbox":"checkbox___j6PNs","info":"info___wAK0H","d1":"d1___lwbvV","d2":"d2___huWI5","d3":"d3___d2Kym","unitPrice":"unitPrice___aqG7f","p":"p___asmlx","l":"l___mD0vI","payType":"payType___WgJ9m","price":"price___j2cbR","status":"status___GMka1","bLeft":"bLeft____8n5u","btn":"btn___JjlGo"});
// EXTERNAL MODULE: ./src/components/ui-customization/index.tsx + 32 modules
var ui_customization = __webpack_require__(89200);
// EXTERNAL MODULE: ./node_modules/_js-base64@2.6.4@js-base64/base64.js
var base64 = __webpack_require__(24334);
// EXTERNAL MODULE: ./node_modules/_react@17.0.2@react/jsx-runtime.js
var jsx_runtime = __webpack_require__(37712);
;// CONCATENATED MODULE: ./src/pages/User/Detail/Order/pages/invoice/index.tsx
var _excluded = ["user", "userDetail", "globalSetting", "dispatch"];
var Page = function Page(_ref) {
var user = _ref.user,
userDetail = _ref.userDetail,
globalSetting = _ref.globalSetting,
dispatch = _ref.dispatch,
props = objectWithoutProperties_default()(_ref, _excluded);
var _useSearchParams = (0,_umi_production_exports.useSearchParams)(),
_useSearchParams2 = slicedToArray_default()(_useSearchParams, 1),
searchParams = _useSearchParams2[0];
var _useState = (0,_react_17_0_2_react.useState)([]),
_useState2 = slicedToArray_default()(_useState, 2),
activeKey = _useState2[0],
setActiveKey = _useState2[1];
var _useState3 = (0,_react_17_0_2_react.useState)([]),
_useState4 = slicedToArray_default()(_useState3, 2),
list = _useState4[0],
setList = _useState4[1];
var _useState5 = (0,_react_17_0_2_react.useState)(true),
_useState6 = slicedToArray_default()(_useState5, 2),
loading = _useState6[0],
setLoading = _useState6[1];
(0,_react_17_0_2_react.useEffect)(function () {
dispatch({
type: 'globalSetting/footerToggle',
payload: false
});
return function () {
dispatch({
type: 'globalSetting/footerToggle',
payload: true
});
};
}, []);
(0,_react_17_0_2_react.useEffect)(function () {
(0,util/* setDocumentTitle */.Dk)('待开票订单');
getData();
}, []);
var getData = /*#__PURE__*/function () {
var _ref2 = asyncToGenerator_default()( /*#__PURE__*/regeneratorRuntime_default()().mark(function _callee() {
var res, _res$orders, ids, dealIds;
return regeneratorRuntime_default()().wrap(function _callee$(_context) {
while (1) switch (_context.prev = _context.next) {
case 0:
setLoading(true);
_context.next = 3;
return (0,fetch/* default */.ZP)("/api/invoices.json", {
method: 'get',
params: {
page: 1,
per_page: 10000
}
});
case 3:
res = _context.sent;
if (res !== null && res !== void 0 && res.orders) {
ids = JSON.parse(searchParams.get("ids")) || [];
dealIds = [];
res === null || res === void 0 || (_res$orders = res.orders) === null || _res$orders === void 0 || _res$orders.forEach(function (e) {
if (ids !== null && ids !== void 0 && ids.includes(e.id)) {
dealIds.push(e.id);
}
});
setActiveKey(dealIds);
setList(res === null || res === void 0 ? void 0 : res.orders);
setLoading(false);
}
case 5:
case "end":
return _context.stop();
}
}, _callee);
}));
return function getData() {
return _ref2.apply(this, arguments);
};
}();
var handleCheckBox = function handleCheckBox(value, id, type) {
var keys = [];
if (type === 'all' && value) {
keys = list.map(function (e) {
return e.id;
});
} else if (type !== 'all') {
if (value) {
keys = [].concat(toConsumableArray_default()(activeKey), [id]);
} else {
keys = activeKey.filter(function (e) {
return e !== id;
});
}
}
setActiveKey(keys);
};
var renderContent = function renderContent() {
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: invoicemodules.content,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: invoicemodules.listTitle,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: invoicemodules.w7,
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z, {
onChange: function onChange(e) {
return handleCheckBox(e.target.checked, null, 'all');
},
checked: !!activeKey.length && activeKey.length === list.length,
indeterminate: !!activeKey.length && activeKey.length !== list.length
})
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
style: {
textAlign: 'left'
},
className: invoicemodules.w1,
children: "\u8BA2\u5355\u4FE1\u606F"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: invoicemodules.w2,
children: "\u5355\u4EF7(\u5143)"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: invoicemodules.w3,
children: "\u5B9E\u4ED8\u91D1\u989D(\u5143)"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: invoicemodules.w6,
children: "\u652F\u4ED8\u65B9\u5F0F"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: invoicemodules.w4,
children: "\u4EA4\u6613\u72B6\u6001"
})]
}), list.map(function (item, index) {
return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: invoicemodules.listContent,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: invoicemodules.checkbox,
children: /*#__PURE__*/(0,jsx_runtime.jsx)(es_checkbox/* default */.Z, {
onChange: function onChange(e) {
return handleCheckBox(e.target.checked, item.id);
},
checked: activeKey.includes(item.id)
})
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: invoicemodules.info,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("a", {
href: "/paths/".concat(item.subject_id),
className: invoicemodules.d1,
children: item.name
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: invoicemodules.d2,
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
children: ["\u8BA2\u5355\u7F16\u53F7\uFF1A", item.num]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
marginLeft: 22
},
children: item.created_at
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: invoicemodules.d3,
children: ["\u8BFE\u7A0B\u6709\u6548\u671F\uFF1A", (item === null || item === void 0 ? void 0 : item.expiration) === '1' && '永久有效', (item === null || item === void 0 ? void 0 : item.expiration) === '2' && "\u8D2D\u4E70\u540E".concat(item === null || item === void 0 ? void 0 : item.days, "\u5929\u6709\u6548"), (item === null || item === void 0 ? void 0 : item.expiration) === '3' && "".concat(item === null || item === void 0 ? void 0 : item.start_at, "\u5230").concat(item === null || item === void 0 ? void 0 : item.end_at)]
})]
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: invoicemodules.unitPrice,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: invoicemodules.p,
children: item.price
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: invoicemodules.l,
children: item.origin_price
})]
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: invoicemodules.price,
children: item.price
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: invoicemodules.payType,
children: item === null || item === void 0 ? void 0 : item.payment_method
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: invoicemodules.status,
children: item.state === 'unpaid' ? '待支付' : item.state === 'expired' ? "已失效" : '交易完成'
})]
}, index);
})]
});
};
var crumbsItem = [{
name: '我的'
}, {
name: '我购买的课程',
path: '/order'
}, {
name: '待开票订单'
}];
var totalPrice = list.reduce(function (sum, obj) {
if (activeKey.includes(obj.id)) {
return sum + parseFloat(obj.price);
}
return sum;
}, 0);
var totalPriceFormatted = totalPrice.toFixed(2);
var handleGoApple = function handleGoApple() {
if (!activeKey.length) {
message/* default */.ZP.warning('请先选择需要开发票的订单');
return;
}
_umi_production_exports.history.push("/order/apply?ids=".concat(encodeURIComponent(JSON.stringify(activeKey)), "&price=").concat(base64.Base64.encode(totalPriceFormatted)));
};
return /*#__PURE__*/(0,jsx_runtime.jsxs)(_react_17_0_2_react.Fragment, {
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(ui_customization/* CustomCrumbs */._b, {
dataSource: crumbsItem
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: invoicemodules.invoice,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
className: invoicemodules.title,
children: "\u5F85\u5F00\u7968\u8BA2\u5355"
}), /*#__PURE__*/(0,jsx_runtime.jsx)(skeleton/* default */.Z, {
loading: loading,
active: true,
paragraph: {
rows: 5
},
children: !!list.length ? renderContent() : /*#__PURE__*/(0,jsx_runtime.jsx)(empty/* default */.Z, {})
}), /*#__PURE__*/(0,jsx_runtime.jsx)(ui_customization/* FixedBottom */.vr, {
LeftContent: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
className: invoicemodules.bLeft,
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("b", {
style: {
color: '#FA6400',
fontSize: 20
},
children: totalPriceFormatted
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
className: "c-grey-333 mr20 ml8",
children: "\u5143"
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
style: {
color: '#9096A3'
},
children: ["\u5171 ", /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
style: {
color: '#3061D0'
},
children: activeKey.length
}), " \u4E2A\u8BA2\u5355"]
})]
}),
RightContent: /*#__PURE__*/(0,jsx_runtime.jsxs)(row/* default */.Z, {
align: "middle",
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(ui_customization/* CustomButton */.op, {
onClick: function onClick() {
return _umi_production_exports.history.push('/order');
},
style: {
borderRadius: 2,
height: 38,
lineHeight: '36px',
background: '#fff',
boxShadow: 'none'
},
children: "\u53D6\u6D88"
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
onClick: handleGoApple,
className: invoicemodules.btn,
children: "\u53BB\u5F00\u7968"
})]
})
})]
})]
});
};
/* harmony default export */ var invoice = ((0,_umi_production_exports.connect)(function (_ref3) {
var user = _ref3.user,
userDetail = _ref3.userDetail,
globalSetting = _ref3.globalSetting;
return {
user: user,
userDetail: userDetail,
globalSetting: globalSetting
};
})(Page));
/***/ })
}]);