s-material-react 0.1.18 → 0.1.20

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.
Files changed (106) hide show
  1. package/css/pages/goodsDetail.scss +3 -2
  2. package/dist/common/addressItem/index.js +1 -0
  3. package/dist/common/icon/index.js +1 -0
  4. package/dist/components/AddressDetail/components/index.d.ts +1 -0
  5. package/dist/components/AddressDetail/components/index.js +1 -1
  6. package/dist/components/AddressDetail/config.js +1 -0
  7. package/dist/components/AddressDetail/index.js +3 -2
  8. package/dist/components/AddressList/index.js +1 -1
  9. package/dist/components/Cart/components/cartItem.js +2 -2
  10. package/dist/components/Cart/components/index.d.ts +1 -0
  11. package/dist/components/Cart/components/index.js +1 -0
  12. package/dist/components/Cart/index.js +3 -3
  13. package/dist/components/ClassifyNav/index.js +4 -14
  14. package/dist/components/CouponList/components/index.d.ts +4 -0
  15. package/dist/components/CouponList/components/index.js +4 -0
  16. package/dist/components/CouponList/components/overdue.d.ts +5 -0
  17. package/dist/components/CouponList/components/overdue.js +6 -0
  18. package/dist/components/CouponList/components/skull.d.ts +2 -0
  19. package/dist/components/CouponList/components/skull.js +9 -0
  20. package/dist/components/CouponList/components/unUsed.d.ts +5 -0
  21. package/dist/components/CouponList/components/unUsed.js +6 -0
  22. package/dist/components/CouponList/components/used.d.ts +5 -0
  23. package/dist/components/CouponList/components/used.js +6 -0
  24. package/dist/components/CouponList/index.js +12 -18
  25. package/dist/components/Cube/index.js +4 -14
  26. package/dist/components/Goods/index.js +1 -0
  27. package/dist/components/GoodsClassify/components/index.d.ts +2 -0
  28. package/dist/components/GoodsClassify/components/index.js +2 -0
  29. package/dist/components/GoodsClassify/index.js +1 -1
  30. package/dist/components/GoodsDetail/components/goodsDetailCollection.d.ts +1 -2
  31. package/dist/components/GoodsDetail/components/goodsDetailCollection.js +1 -2
  32. package/dist/components/GoodsDetail/components/goodsDetailCoupon.d.ts +1 -2
  33. package/dist/components/GoodsDetail/components/goodsDetailCoupon.js +4 -3
  34. package/dist/components/GoodsDetail/components/goodsDetailEvaluate.d.ts +1 -2
  35. package/dist/components/GoodsDetail/components/goodsDetailEvaluate.js +2 -3
  36. package/dist/components/GoodsDetail/components/goodsDetailHandleBar.d.ts +1 -2
  37. package/dist/components/GoodsDetail/components/goodsDetailHandleBar.js +3 -4
  38. package/dist/components/GoodsDetail/components/goodsDetailInfo.d.ts +1 -2
  39. package/dist/components/GoodsDetail/components/goodsDetailInfo.js +1 -2
  40. package/dist/components/GoodsDetail/components/goodsDetailPopup.d.ts +1 -2
  41. package/dist/components/GoodsDetail/components/goodsDetailPopup.js +3 -4
  42. package/dist/components/GoodsDetail/components/goodsDetailPromotion.d.ts +1 -2
  43. package/dist/components/GoodsDetail/components/goodsDetailPromotion.js +2 -2
  44. package/dist/components/GoodsDetail/components/goodsDetailSize.d.ts +1 -2
  45. package/dist/components/GoodsDetail/components/goodsDetailSize.js +4 -4
  46. package/dist/components/GoodsDetail/components/index.d.ts +9 -0
  47. package/dist/components/GoodsDetail/components/index.js +9 -0
  48. package/dist/components/GoodsDetail/index.js +4 -9
  49. package/dist/components/GoodsGroup/index.js +1 -0
  50. package/dist/components/GoodsList/components/index.d.ts +1 -0
  51. package/dist/components/GoodsList/components/index.js +1 -0
  52. package/dist/components/GoodsList/index.js +3 -2
  53. package/dist/components/Mine/components/index.d.ts +2 -0
  54. package/dist/components/Mine/components/index.js +2 -0
  55. package/dist/components/Mine/index.js +3 -3
  56. package/dist/components/OrderDetail/index.js +1 -0
  57. package/dist/components/OrderList/components/index.d.ts +3 -0
  58. package/dist/components/OrderList/components/index.js +3 -0
  59. package/dist/components/OrderList/components/{OrderListItem.d.ts → orderListItem.d.ts} +0 -0
  60. package/dist/components/OrderList/components/{OrderListItem.js → orderListItem.js} +1 -1
  61. package/dist/components/OrderList/index.js +1 -1
  62. package/dist/components/PaymentMode/hooks/useOrderResult.js +1 -2
  63. package/dist/components/PaymentMode/index.js +2 -1
  64. package/dist/components/PlaceOrder/components/index.d.ts +3 -0
  65. package/dist/components/PlaceOrder/components/index.js +3 -0
  66. package/dist/components/PlaceOrder/components/orderPrice.d.ts +2 -2
  67. package/dist/components/PlaceOrder/components/orderPrice.js +1 -2
  68. package/dist/components/PlaceOrder/components/shop.d.ts +1 -2
  69. package/dist/components/PlaceOrder/components/shop.js +1 -2
  70. package/dist/components/PlaceOrder/index.js +2 -4
  71. package/dist/components/PlaceOrderResult/index.js +7 -4
  72. package/dist/components/Search/index.js +1 -0
  73. package/dist/components/SearchPage/index.js +1 -1
  74. package/dist/components/Slider/index.js +3 -14
  75. package/dist/components/Slider/item.js +1 -0
  76. package/dist/utils/index.d.ts +1 -0
  77. package/dist/utils/index.js +1 -1
  78. package/dist/utils/serviceActionSheet.d.ts +1 -0
  79. package/dist/utils/serviceActionSheet.js +31 -0
  80. package/package.json +13 -12
  81. package/dist/components/AddressDetail/hooks/index.d.ts +0 -1
  82. package/dist/components/AddressDetail/hooks/index.js +0 -1
  83. package/dist/components/AddressDetail/hooks/useAddAddress.d.ts +0 -26
  84. package/dist/components/AddressDetail/hooks/useAddAddress.js +0 -80
  85. package/dist/components/AddressList/hooks/index.d.ts +0 -1
  86. package/dist/components/AddressList/hooks/index.js +0 -1
  87. package/dist/components/AddressList/hooks/useAddressList.d.ts +0 -6
  88. package/dist/components/AddressList/hooks/useAddressList.js +0 -74
  89. package/dist/components/Cart/hooks/index.d.ts +0 -19
  90. package/dist/components/Cart/hooks/index.js +0 -90
  91. package/dist/components/Cart/store/index.d.ts +0 -10
  92. package/dist/components/Cart/store/index.js +0 -23
  93. package/dist/components/GoodsDetail/hooks/index.d.ts +0 -2
  94. package/dist/components/GoodsDetail/hooks/index.js +0 -2
  95. package/dist/components/GoodsDetail/hooks/useAddShopping.d.ts +0 -10
  96. package/dist/components/GoodsDetail/hooks/useAddShopping.js +0 -74
  97. package/dist/components/GoodsDetail/hooks/useGoodsDetailImpl.d.ts +0 -13
  98. package/dist/components/GoodsDetail/hooks/useGoodsDetailImpl.js +0 -85
  99. package/dist/components/GoodsDetail/store/index.d.ts +0 -10
  100. package/dist/components/GoodsDetail/store/index.js +0 -34
  101. package/dist/components/GoodsList/hooks/useGoodsList.d.ts +0 -12
  102. package/dist/components/GoodsList/hooks/useGoodsList.js +0 -54
  103. package/dist/components/PlaceOrder/hooks/usePlaceOrder.d.ts +0 -18
  104. package/dist/components/PlaceOrder/hooks/usePlaceOrder.js +0 -234
  105. package/dist/components/PlaceOrderResult/hooks/useOrderResult.d.ts +0 -3
  106. package/dist/components/PlaceOrderResult/hooks/useOrderResult.js +0 -93
@@ -1,10 +0,0 @@
1
- /**
2
- * =========== StoreProvider, useStore, useDispatchImpl ============
3
- * 导出三个参数
4
- * 第一个是Provider
5
- * 第二个是Store
6
- * 第三个是Dispath
7
- *
8
- */
9
- declare const StoreProvider: any, useStore: any, useDispatchImpl: any;
10
- export { StoreProvider, useStore, useDispatchImpl };
@@ -1,23 +0,0 @@
1
- import { makeStore } from 'qj-mobile-store';
2
- const defaultValues = {
3
- count: 1,
4
- select: []
5
- };
6
- function reduceImpl(state, action) {
7
- switch (action.type) {
8
- case 'select':
9
- return Object.assign(Object.assign({}, state), { select: action.payload });
10
- default:
11
- return state;
12
- }
13
- }
14
- /**
15
- * =========== StoreProvider, useStore, useDispatchImpl ============
16
- * 导出三个参数
17
- * 第一个是Provider
18
- * 第二个是Store
19
- * 第三个是Dispath
20
- *
21
- */
22
- const [StoreProvider, useStore, useDispatchImpl] = makeStore(reduceImpl, defaultValues);
23
- export { StoreProvider, useStore, useDispatchImpl };
@@ -1,2 +0,0 @@
1
- export * from './useAddShopping';
2
- export * from './useGoodsDetailImpl';
@@ -1,2 +0,0 @@
1
- export * from './useAddShopping';
2
- export * from './useGoodsDetailImpl';
@@ -1,10 +0,0 @@
1
- export declare function useAddShopping(): {
2
- count: any;
3
- spec: any;
4
- popupVisible: any;
5
- isNeedButton: any;
6
- handleChooseSize: (value: string) => void;
7
- handleStep: (type: string) => void;
8
- addShoppingImpl: () => void;
9
- popupHandler: () => void;
10
- };
@@ -1,74 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { useDispatchImpl, useStore } from '../store';
11
- import { _ } from '@brushes/tools';
12
- import { checkSkuSpec, addCardSku } from '../../../utils/payment';
13
- import { navigatorImpl } from '@brushes/qj-simulate-component';
14
- import { routerMap } from '../../../routerMap';
15
- const { get } = _;
16
- export function useAddShopping() {
17
- const { count, spec, orderType, popupVisible, isNeedButton, goodsCode } = useStore();
18
- const dispatch = useDispatchImpl();
19
- const handleChooseSize = (value) => {
20
- dispatch({
21
- type: 'select',
22
- payload: {
23
- spec: value
24
- }
25
- });
26
- };
27
- const popupHandler = () => {
28
- dispatch({
29
- type: 'popupImpl',
30
- payload: {
31
- popupVisible: !popupVisible
32
- }
33
- });
34
- };
35
- const handleStep = (type) => {
36
- dispatch({
37
- type
38
- });
39
- };
40
- const addCardImpl = () => __awaiter(this, void 0, void 0, function* () {
41
- try {
42
- const data = yield checkSkuSpec(spec, goodsCode);
43
- const skuId = get(data, 'dataObj.skuId');
44
- yield addCardSku(skuId, count);
45
- popupHandler();
46
- }
47
- catch (err) { }
48
- });
49
- const cashImpl = () => __awaiter(this, void 0, void 0, function* () {
50
- const data = yield checkSkuSpec(spec, goodsCode);
51
- const skuId = get(data, 'dataObj.skuId');
52
- navigatorImpl(`${routerMap.confirm}?skuId=${skuId}&goodsNum=${count}`);
53
- });
54
- const addShoppingImpl = () => {
55
- if (orderType === 0) {
56
- // 添加到购物车
57
- addCardImpl();
58
- }
59
- else {
60
- // 去支付页面
61
- cashImpl();
62
- }
63
- };
64
- return {
65
- count,
66
- spec,
67
- popupVisible,
68
- isNeedButton,
69
- handleChooseSize,
70
- handleStep,
71
- addShoppingImpl,
72
- popupHandler
73
- };
74
- }
@@ -1,13 +0,0 @@
1
- /// <reference types="react" />
2
- import { itemType } from '../../Slider';
3
- export declare const useGoodsDetailImpl: (skuCode: string) => {
4
- promotionArr: never[];
5
- checkCollectionObj: {};
6
- setCheckCollectionObj: import("react").Dispatch<import("react").SetStateAction<{}>>;
7
- sliderArr: itemType[];
8
- tabActive: number;
9
- setTabActive: import("react").Dispatch<import("react").SetStateAction<number>>;
10
- popupVisible: boolean;
11
- setPopupVisible: import("react").Dispatch<import("react").SetStateAction<boolean>>;
12
- goods: {};
13
- };
@@ -1,85 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { useEffect, useState } from 'react';
11
- import { getResourceGoodsInfoBySkuCode, queryPromotionListByGoodsCode } from '@brushes/api';
12
- import { _ } from '@brushes/tools';
13
- import { useDispatchImpl } from '../store';
14
- const { isEmpty, get } = _;
15
- export const useGoodsDetailImpl = (skuCode) => {
16
- const [goods, setGoods] = useState({});
17
- const [promotionArr, setPromotionArr] = useState([]);
18
- const [checkCollectionObj, setCheckCollectionObj] = useState({});
19
- const [sliderArr, setSliderArr] = useState([]);
20
- const [tabActive, setTabActive] = useState(1);
21
- const [popupVisible, setPopupVisible] = useState(false);
22
- const dispatch = useDispatchImpl();
23
- useEffect(() => {
24
- getGoodsDetailData();
25
- }, []);
26
- const getGoodsDetailData = () => __awaiter(void 0, void 0, void 0, function* () {
27
- try {
28
- const goodsDetailResult = yield getResourceGoodsInfoBySkuCode({
29
- skuCode
30
- // isLocalMock: true
31
- });
32
- const promotionListParams = {
33
- skuNo: goodsDetailResult.skuNo || '',
34
- skuCode: goodsDetailResult.rsSkuDomainList[0].skuCode || '',
35
- classtreeCode: goodsDetailResult.classtreeCode || '',
36
- brandCode: goodsDetailResult.brandCode || '',
37
- pntreeCode: goodsDetailResult.pntreeCode || '',
38
- memberCode: goodsDetailResult.memberCode || ''
39
- };
40
- const arr = get(goodsDetailResult, 'rsGoodsFileDomainList', []);
41
- if (isEmpty(arr))
42
- return;
43
- const sliderData = arr.map((item) => {
44
- return {
45
- imgUrl: item.goodsFileUrl,
46
- link: ''
47
- };
48
- });
49
- dispatch({
50
- type: 'initGoods',
51
- payload: {
52
- spec: get(goodsDetailResult, 'rsSpecValueDomainList[0].specValueValue', ''),
53
- goodsCode: goodsDetailResult.goodsCode,
54
- goodsNum: goodsDetailResult.goodsNum
55
- }
56
- });
57
- setSliderArr(sliderData);
58
- setGoods(goodsDetailResult);
59
- getPromotionData(promotionListParams);
60
- }
61
- catch (err) {
62
- console.log(59, err);
63
- }
64
- });
65
- const getPromotionData = (params) => __awaiter(void 0, void 0, void 0, function* () {
66
- try {
67
- const result = yield queryPromotionListByGoodsCode(params);
68
- setPromotionArr(result);
69
- }
70
- catch (err) {
71
- console.log(err);
72
- }
73
- });
74
- return {
75
- promotionArr,
76
- checkCollectionObj,
77
- setCheckCollectionObj,
78
- sliderArr,
79
- tabActive,
80
- setTabActive,
81
- popupVisible,
82
- setPopupVisible,
83
- goods
84
- };
85
- };
@@ -1,10 +0,0 @@
1
- /**
2
- * =========== StoreProvider, useStore, useDispatchImpl ============
3
- * 导出三个参数
4
- * 第一个是Provider
5
- * 第二个是Store
6
- * 第三个是Dispath
7
- *
8
- */
9
- declare const StoreProvider: any, useStore: any, useDispatchImpl: any;
10
- export { StoreProvider, useStore, useDispatchImpl };
@@ -1,34 +0,0 @@
1
- import { makeStore } from 'qj-mobile-store';
2
- const defaultValues = {
3
- count: 1,
4
- orderType: 0,
5
- isNeedButton: false,
6
- popupVisible: false,
7
- goodsNum: 1,
8
- goodsCode: ''
9
- };
10
- function reduceImpl(state, action) {
11
- switch (action.type) {
12
- case 'plus':
13
- return Object.assign(Object.assign({}, state), { count: state.count + 1 });
14
- case 'minus':
15
- return Object.assign(Object.assign({}, state), { count: state.count - 1 });
16
- case 'select':
17
- case 'initGoods':
18
- case 'popupImpl':
19
- return Object.assign(Object.assign({}, state), action.payload);
20
- default:
21
- return state;
22
- }
23
- }
24
- /**
25
- * =========== StoreProvider, useStore, useDispatchImpl ============
26
- * 导出三个参数
27
- * 第一个是Provider
28
- * 第二个是Store
29
- * 第三个是Dispath
30
- *
31
- */
32
- const [StoreProvider, useStore, useDispatchImpl] = makeStore(reduceImpl, defaultValues);
33
- // demo
34
- export { StoreProvider, useStore, useDispatchImpl };
@@ -1,12 +0,0 @@
1
- import { FilterType } from '../index';
2
- export interface ListType {
3
- skuCode: string;
4
- dataPic: string;
5
- goodsName: string;
6
- pricesetNprice: number;
7
- }
8
- export declare function useGoodsList(classtreeCode: string, searchParam: string, filterParmas: FilterType): {
9
- loading: boolean;
10
- getData: (...args: any[]) => any;
11
- list: ListType[];
12
- };
@@ -1,54 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { useEffect, useRef, useState } from 'react';
11
- import { find } from '@brushes/api';
12
- import { _, useImmutableCallback } from '@brushes/tools';
13
- const { isEmpty } = _;
14
- export function useGoodsList(classtreeCode, searchParam, filterParmas) {
15
- const isCanScroll = useRef(true);
16
- const num = useRef(0);
17
- const [list, setList] = useState([]);
18
- const [loading, setLoading] = useState(false);
19
- useEffect(() => {
20
- resetImpl();
21
- }, [filterParmas]);
22
- const resetImpl = useImmutableCallback(() => {
23
- num.current = 0;
24
- isCanScroll.current = true;
25
- setList([]);
26
- getData(filterParmas);
27
- });
28
- const getData = useImmutableCallback(({ sortField = 'pricesetNprice', order = '' }) => __awaiter(this, void 0, void 0, function* () {
29
- if (!isCanScroll.current)
30
- return;
31
- ++num.current;
32
- setLoading(true);
33
- const response = yield find({
34
- distinctField: 'goodsNo',
35
- sortField,
36
- order: order,
37
- goodsType: '00,50',
38
- page: num.current,
39
- rows: 10,
40
- searchParam,
41
- classtreeCode
42
- });
43
- if (isEmpty(response.list)) {
44
- isCanScroll.current = false;
45
- }
46
- setLoading(false);
47
- setList((prevState) => prevState.concat(response.list));
48
- }));
49
- return {
50
- loading,
51
- getData,
52
- list
53
- };
54
- }
@@ -1,18 +0,0 @@
1
- /// <reference types="react" />
2
- import { PaymentOrderType } from '../index';
3
- export declare function usePlaceOrder({ skuId, goodsNum, shoppingGoodsId }: PaymentOrderType): {
4
- savePayPrice: () => void;
5
- address: any;
6
- list: import("react").MutableRefObject<any[]>;
7
- payState: import("react").MutableRefObject<{
8
- contractSettlOpno: number;
9
- promotionCodes: null;
10
- shoppingCountPrice: number;
11
- totalDiscountPrice: number;
12
- accountsSumPrice: number;
13
- discount: number;
14
- freight: number;
15
- comDisMoney: number;
16
- copyComDisMoney: number;
17
- }>;
18
- };
@@ -1,234 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { queryToContractImpl, queryAddressBymerberCode, getFalgSettingForPaydate, calculateFreightFare, getTotalDiscountPriceImpl, saveContract, queryShoppingToContract } from '../../../utils/payment';
11
- import { useEffect, useRef, useState } from 'react';
12
- import { _ } from '@brushes/tools';
13
- import { navigatorImpl } from '@brushes/qj-simulate-component';
14
- import { routerMap } from '../../../routerMap';
15
- const { set } = _;
16
- export function usePlaceOrder({ skuId, goodsNum, shoppingGoodsId }) {
17
- const list = useRef([]);
18
- const [address, setAddress] = useState({});
19
- const promotionCode = useRef('');
20
- const ocContractSettlList = useRef([]); //优惠信息
21
- const shoppingGoodsList = useRef([]); // 获取优惠劵列表需要传所有商品的参数
22
- const rsSkuListStr = useRef([]);
23
- const payState = useRef({
24
- contractSettlOpno: 0,
25
- promotionCodes: null,
26
- shoppingCountPrice: 0,
27
- totalDiscountPrice: 0,
28
- accountsSumPrice: 0,
29
- discount: 0,
30
- freight: 0,
31
- comDisMoney: 0,
32
- copyComDisMoney: 0
33
- });
34
- useEffect(() => {
35
- (() => __awaiter(this, void 0, void 0, function* () {
36
- // 初始化地址信息
37
- // 预订单详情
38
- // 购物车到下单页面
39
- if (shoppingGoodsId) {
40
- yield initImpl(() => queryShoppingToContract({
41
- shoppingGoodsIdStr: `[${shoppingGoodsId}]`
42
- }));
43
- }
44
- else {
45
- // 商品详情到下单页
46
- yield initImpl(() => queryToContractImpl(skuId, goodsNum));
47
- }
48
- }))();
49
- }, []);
50
- const initImpl = (callback) => __awaiter(this, void 0, void 0, function* () {
51
- const data = yield Promise.all([queryAddressBymerberCode(), callback()]);
52
- const [addressData = [], contractData] = data;
53
- const addressInfo = addressData.find((item) => item.addressDefault === '1');
54
- setAddress(addressInfo);
55
- computedValue(contractData);
56
- });
57
- //
58
- // const initializePrice = () => {
59
- // // 初始化涉及到钱的变量,防止页面从后台到前台的时候在原有基础上再次计算
60
- // that.shoppingCountPrice = 0;
61
- // that.totalDiscountPrice = 0;
62
- // that.accountsSumPrice = 0;
63
- // that.discount = 0;
64
- // that.freight = 0;
65
- // that.comDisMoney = 0;
66
- // that.copyComDisMoney = 0;
67
- // // that.baseColor = '#' + $storage.get('baseColor');
68
- // }
69
- const computedValue = (res) => {
70
- res.forEach((v) => {
71
- // 查看商品是否促销
72
- v.shoppingpackageList.forEach((vk) => {
73
- payState.current.comDisMoney += vk.disMoney;
74
- payState.current.copyComDisMoney += vk.disMoney;
75
- vk.shoppingGoodsList.forEach((item) => {
76
- shoppingGoodsList.current.push(item);
77
- payState.current.shoppingCountPrice += item.pricesetNprice * item.goodsCamount;
78
- item.contractGoodsGtype = 0;
79
- promotionCode.current = vk.promotionCode;
80
- console.log(82, promotionCode.current);
81
- // 普通商品获取自动取消订单时间
82
- if (item.goodsType == '00') {
83
- getFalgSettingForPaydate().then((res) => {
84
- if (res) {
85
- // 暂时放这里不处理
86
- // $storage.set('payTime', Number(res.flagSettingInfo));
87
- }
88
- });
89
- }
90
- });
91
- // 优惠
92
- if (vk.disMoney > 0) {
93
- ocContractSettlList.current.push({
94
- contractSettlBlance: vk.promotionInType == 0 ? 'PM' : 'COP',
95
- contractPmode: '0',
96
- contractSettlGmoney: Number(vk.disMoney.toFixed(2)),
97
- contractSettlPmoney: Number(vk.disMoney.toFixed(2)),
98
- contractSettlOpno: vk.promotionCode,
99
- contractSettlOpemo: vk.promotionName
100
- });
101
- }
102
- if (vk.giftList) {
103
- vk.shoppingGoodsList.forEach((eItem) => {
104
- // 满赠 0001
105
- eItem.ginfoCode = eItem.pmPromotionList.find((gift) => gift.pbCode == '0001').promotionCode;
106
- });
107
- list.current = [...vk.shoppingGoodsList, ...vk.giftList];
108
- }
109
- else {
110
- list.current = vk.shoppingGoodsList;
111
- }
112
- });
113
- resultPrice();
114
- //运费计算
115
- freightCalculation();
116
- //用户权益差价
117
- userEquitySpread();
118
- });
119
- };
120
- const resultPrice = () => {
121
- const { shoppingCountPrice, totalDiscountPrice, discount, comDisMoney, freight } = payState.current;
122
- payState.current.accountsSumPrice = shoppingCountPrice - totalDiscountPrice - discount - comDisMoney + freight;
123
- };
124
- //运费计算
125
- const freightCalculation = () => __awaiter(this, void 0, void 0, function* () {
126
- let payload = {};
127
- if (shoppingGoodsId) {
128
- // 购物车计算运费
129
- payload = { shoppingGoodsIdStr: `[${shoppingGoodsId}]` };
130
- }
131
- else {
132
- // 商品详情计算运费
133
- payload = { skuIdStr: JSON.stringify([{ skuId, goodsNum }]) };
134
- }
135
- const data = yield calculateFreightFare(Object.assign(Object.assign({}, payload), { areaCode: 110000 }));
136
- payState.current.freight = data.dataObj;
137
- resultPrice();
138
- });
139
- // 参数数据处理
140
- const paramsDataHandle = () => {
141
- return [
142
- {
143
- contractPaytime: new Date().valueOf(),
144
- contractPaydate: new Date().valueOf(),
145
- goodsPbillno: 0,
146
- goodsPmbillno: payState.current.promotionCodes,
147
- contractProperty: '0',
148
- contractBlance: 0,
149
- contractPmode: 0,
150
- contractPumode: '0',
151
- goodsSupplierName: '',
152
- goodsSupplierCode: '',
153
- packageList: [
154
- {
155
- contractGoodsList: list.current,
156
- shoppingGoodsIdList: [],
157
- promotionCode: promotionCode.current,
158
- packageRemark: null
159
- }
160
- ],
161
- packageMode: '',
162
- contractType: '00',
163
- ocContractSettlList: [],
164
- contractInmoney: salesTax(),
165
- contractMoney: finalSales(),
166
- goodsReceiptMem: '1',
167
- goodsReceiptPhone: '13123123112',
168
- goodsReceiptArrdess: '北京市北京市东城区123',
169
- areaCode: '110000',
170
- contractNbillcode: null,
171
- skuIdList: skuId
172
- ? [
173
- {
174
- skuId: +skuId,
175
- goodsNum: +goodsNum
176
- }
177
- ]
178
- : [],
179
- giftSkuIdList: []
180
- }
181
- ];
182
- };
183
- // 最终销售含税金额 (优惠后)
184
- const finalSales = () => {
185
- const { shoppingCountPrice, copyComDisMoney, discount } = payState.current;
186
- return (shoppingCountPrice - copyComDisMoney - discount).toFixed(2);
187
- };
188
- // 销售含税金额 (优惠前)
189
- const salesTax = () => {
190
- const { shoppingCountPrice, copyComDisMoney, freight } = payState.current;
191
- return (shoppingCountPrice - copyComDisMoney + freight).toFixed(2);
192
- };
193
- // 用户权益差价计算
194
- const userEquitySpread = () => {
195
- rsSkuListStr.current = paramsDataHandle();
196
- let skuList = { rsSkuListStr: JSON.stringify(rsSkuListStr.current) };
197
- getTotalDiscountPriceImpl(skuList).then((res) => {
198
- payState.current.totalDiscountPrice = res.dataObj.totalDiscountPrice;
199
- payState.current.contractSettlOpno = res.dataObj.contractSettlOpno;
200
- resultPrice();
201
- });
202
- };
203
- // 会员权益差价
204
- const getMembership = () => {
205
- const { contractSettlOpno, totalDiscountPrice } = payState.current;
206
- if (contractSettlOpno && totalDiscountPrice != 0) {
207
- // index 暂时 0;
208
- ocContractSettlList.current.push({
209
- contractSettlBlance: 'UR',
210
- contractPmode: '0',
211
- contractSettlPmoney: totalDiscountPrice,
212
- contractSettlOpno
213
- });
214
- }
215
- };
216
- //计算优惠券
217
- const getCouple = () => { };
218
- // 确认预订单 立即支付
219
- const savePayPrice = () => {
220
- getMembership();
221
- // 优惠信息
222
- set(rsSkuListStr.current, '[0].ocContractSettlList', ocContractSettlList.current);
223
- const params = { orderDomainStr: JSON.stringify(rsSkuListStr.current) };
224
- saveContract(params).then((res) => {
225
- navigatorImpl(`${routerMap.paymentMode}?code=${res.dataObj.contractBillcode}`);
226
- });
227
- };
228
- return {
229
- savePayPrice,
230
- address,
231
- list,
232
- payState
233
- };
234
- }
@@ -1,3 +0,0 @@
1
- export declare function useOrderResult(code: string): {
2
- paymentImpl: () => Promise<void>;
3
- };