s-material-react 0.1.13 → 0.1.15

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 (124) hide show
  1. package/css/common/addressItem.scss +41 -1
  2. package/css/common/card.scss +1 -0
  3. package/css/common/coupon.scss +8 -3
  4. package/css/common/icon.scss +79 -3
  5. package/css/pages/addressDetail.scss +79 -0
  6. package/css/pages/addressList.scss +32 -8
  7. package/css/pages/cart.scss +52 -5
  8. package/css/pages/couponList.scss +5 -0
  9. package/css/pages/goodsClassify.scss +32 -6
  10. package/css/pages/goodsDetail.scss +22 -67
  11. package/css/pages/index.scss +2 -0
  12. package/css/pages/mine.scss +2 -6
  13. package/css/pages/orderEntry.scss +4 -2
  14. package/css/pages/paymentMode.scss +75 -0
  15. package/css/pages/placeOrder.scss +30 -8
  16. package/css/pages/service.scss +1 -6
  17. package/css/pages/slider.scss +6 -0
  18. package/dist/common/addressItem/index.d.ts +1 -1
  19. package/dist/common/addressItem/index.js +6 -7
  20. package/dist/common/card/index.js +1 -1
  21. package/dist/common/coupon/index.d.ts +1 -1
  22. package/dist/common/coupon/index.js +4 -5
  23. package/dist/common/icon/index.d.ts +2 -1
  24. package/dist/common/icon/index.js +2 -2
  25. package/dist/common/mock/index.js +35 -0
  26. package/dist/components/AddressDetail/components/index.d.ts +0 -0
  27. package/dist/components/AddressDetail/components/index.js +1 -0
  28. package/dist/components/AddressDetail/components/skull.d.ts +2 -0
  29. package/dist/components/AddressDetail/components/skull.js +9 -0
  30. package/dist/components/AddressDetail/config.d.ts +51 -0
  31. package/dist/components/AddressDetail/config.js +65 -0
  32. package/dist/components/AddressDetail/hooks/index.d.ts +1 -0
  33. package/dist/components/AddressDetail/hooks/index.js +1 -0
  34. package/dist/components/AddressDetail/hooks/useAddAddress.d.ts +26 -0
  35. package/dist/components/AddressDetail/hooks/useAddAddress.js +80 -0
  36. package/dist/components/AddressDetail/index.d.ts +1 -1
  37. package/dist/components/AddressDetail/index.js +17 -107
  38. package/dist/components/AddressList/components/index.d.ts +1 -0
  39. package/dist/components/AddressList/components/index.js +1 -0
  40. package/dist/components/AddressList/components/skull.d.ts +2 -0
  41. package/dist/components/AddressList/components/skull.js +9 -0
  42. package/dist/components/AddressList/hooks/index.d.ts +1 -0
  43. package/dist/components/AddressList/hooks/index.js +1 -0
  44. package/dist/components/AddressList/hooks/useAddressList.d.ts +6 -0
  45. package/dist/components/AddressList/hooks/useAddressList.js +74 -0
  46. package/dist/components/AddressList/index.js +8 -6
  47. package/dist/components/Cart/components/cartItem.d.ts +3 -0
  48. package/dist/components/Cart/components/cartItem.js +34 -0
  49. package/dist/components/Cart/hooks/index.d.ts +19 -0
  50. package/dist/components/Cart/hooks/index.js +90 -0
  51. package/dist/components/Cart/index.js +14 -18
  52. package/dist/components/Cart/store/index.d.ts +10 -0
  53. package/dist/components/Cart/store/index.js +23 -0
  54. package/dist/components/CouponList/index.js +1 -1
  55. package/dist/components/Goods/index.js +3 -3
  56. package/dist/components/GoodsClassify/components/classifySkeleton.d.ts +1 -0
  57. package/dist/components/GoodsClassify/components/classifySkeleton.js +12 -0
  58. package/dist/components/GoodsClassify/index.js +4 -4
  59. package/dist/components/GoodsDetail/components/goodsDetailCollection.d.ts +1 -1
  60. package/dist/components/GoodsDetail/components/goodsDetailCollection.js +8 -3
  61. package/dist/components/GoodsDetail/components/goodsDetailCoupon.js +22 -33
  62. package/dist/components/GoodsDetail/components/goodsDetailHandleBar.js +23 -3
  63. package/dist/components/GoodsDetail/components/goodsDetailInfo.d.ts +1 -1
  64. package/dist/components/GoodsDetail/components/goodsDetailInfo.js +1 -1
  65. package/dist/components/GoodsDetail/components/goodsDetailPopup.d.ts +1 -1
  66. package/dist/components/GoodsDetail/components/goodsDetailPopup.js +9 -23
  67. package/dist/components/GoodsDetail/components/goodsDetailPromotion.js +2 -3
  68. package/dist/components/GoodsDetail/components/goodsDetailSize.d.ts +1 -1
  69. package/dist/components/GoodsDetail/components/goodsDetailSize.js +11 -2
  70. package/dist/components/GoodsDetail/hooks/index.d.ts +2 -0
  71. package/dist/components/GoodsDetail/hooks/index.js +2 -75
  72. package/dist/components/GoodsDetail/hooks/useAddShopping.d.ts +10 -0
  73. package/dist/components/GoodsDetail/hooks/useAddShopping.js +74 -0
  74. package/dist/components/GoodsDetail/hooks/useGoodsDetailImpl.d.ts +13 -0
  75. package/dist/components/GoodsDetail/hooks/useGoodsDetailImpl.js +85 -0
  76. package/dist/components/GoodsDetail/index.d.ts +5 -1
  77. package/dist/components/GoodsDetail/index.js +15 -8
  78. package/dist/components/GoodsDetail/store/index.d.ts +10 -0
  79. package/dist/components/GoodsDetail/store/index.js +34 -0
  80. package/dist/components/Mine/components/menuList.js +7 -6
  81. package/dist/components/Mine/components/orderEntry.js +17 -10
  82. package/dist/components/Mine/index.js +4 -3
  83. package/dist/components/OrderList/components/OrderListItem.js +2 -3
  84. package/dist/components/OrderList/components/orderItem.js +1 -2
  85. package/dist/components/PaymentMode/config.d.ts +6 -0
  86. package/dist/components/PaymentMode/config.js +14 -0
  87. package/dist/components/PaymentMode/hooks/useOrderResult.d.ts +11 -0
  88. package/dist/components/PaymentMode/hooks/useOrderResult.js +100 -0
  89. package/dist/components/PaymentMode/index.d.ts +4 -0
  90. package/dist/components/PaymentMode/index.js +17 -0
  91. package/dist/components/PlaceOrder/components/address.d.ts +12 -0
  92. package/dist/components/PlaceOrder/components/address.js +33 -0
  93. package/dist/components/PlaceOrder/components/orderPrice.d.ts +12 -0
  94. package/dist/components/PlaceOrder/components/orderPrice.js +8 -0
  95. package/dist/components/PlaceOrder/components/shop.d.ts +4 -0
  96. package/dist/components/PlaceOrder/components/shop.js +9 -0
  97. package/dist/components/PlaceOrder/hooks/usePlaceOrder.d.ts +18 -0
  98. package/dist/components/PlaceOrder/hooks/usePlaceOrder.js +234 -0
  99. package/dist/components/PlaceOrder/index.d.ts +6 -1
  100. package/dist/components/PlaceOrder/index.js +8 -3
  101. package/dist/components/PlaceOrderResult/hooks/useOrderResult.d.ts +3 -0
  102. package/dist/components/PlaceOrderResult/hooks/useOrderResult.js +93 -0
  103. package/dist/components/PlaceOrderResult/index.d.ts +3 -1
  104. package/dist/components/PlaceOrderResult/index.js +5 -3
  105. package/dist/components/Search/index.js +3 -2
  106. package/dist/components/SearchPage/index.js +50 -9
  107. package/dist/components/Service/index.d.ts +11 -1
  108. package/dist/components/Service/index.js +4 -3
  109. package/dist/components/index.d.ts +1 -0
  110. package/dist/components/index.js +1 -0
  111. package/dist/options/index.d.ts +0 -2
  112. package/dist/options/index.js +36 -31
  113. package/dist/routerMap/index.d.ts +7 -0
  114. package/dist/routerMap/index.js +8 -1
  115. package/dist/utils/payment.d.ts +14 -0
  116. package/dist/utils/payment.js +56 -0
  117. package/package.json +1 -1
  118. package/css/font/iconfont.ttf +0 -0
  119. package/css/font/iconfont.woff +0 -0
  120. package/css/font/iconfont.woff2 +0 -0
  121. package/dist/components/AddressDetail/option.d.ts +0 -2
  122. package/dist/components/AddressDetail/option.js +0 -32
  123. package/dist/components/Cart/useNumStep.d.ts +0 -1
  124. package/dist/components/Cart/useNumStep.js +0 -7
@@ -0,0 +1,234 @@
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,2 +1,7 @@
1
1
  /// <reference types="react" />
2
- export declare const PlaceOrder: import("react").MemoExoticComponent<() => JSX.Element>;
2
+ export interface PaymentOrderType {
3
+ skuId?: string;
4
+ goodsNum?: string;
5
+ shoppingGoodsId?: string;
6
+ }
7
+ export declare const PlaceOrder: import("react").NamedExoticComponent<PaymentOrderType>;
@@ -3,11 +3,16 @@ import { memo } from 'react';
3
3
  import { navigatorImpl, useComponent } from '@brushes/qj-simulate-component';
4
4
  import { getEnv } from '@brushes/api';
5
5
  import { routerMap } from '../../routerMap';
6
+ import { usePlaceOrder } from './hooks/usePlaceOrder';
7
+ import { Address } from './components/address';
8
+ import ShopJsx from './components/shop';
9
+ import OrderPrice from './components/orderPrice';
6
10
  const flag = getEnv();
7
- const PlaceOrderJsx = () => {
11
+ const PlaceOrderJsx = ({ goodsNum, skuId, shoppingGoodsId }) => {
8
12
  const { View, Text } = useComponent();
13
+ const { savePayPrice, address, list, payState } = usePlaceOrder({ skuId, goodsNum, shoppingGoodsId });
9
14
  return (_jsxs(View, Object.assign({ className: 'placeOrder', style: {
10
- height: flag ? '100vh' : '600px'
11
- } }, { children: [_jsxs(View, Object.assign({ className: 'chooseAddress' }, { children: [_jsxs(View, Object.assign({ className: 'group' }, { children: [_jsx(Text, { className: 'local' }), _jsx(Text, Object.assign({ className: 'address' }, { children: "\u9009\u62E9\u6536\u8D27\u5730\u5740" }))] })), _jsx(Text, { className: 'arrow' })] })), _jsxs(View, Object.assign({ className: 'info blcWrap' }, { children: [_jsxs(View, Object.assign({ className: 'express blcItem' }, { children: [_jsx(View, Object.assign({ className: 'label' }, { children: "\u914D\u9001\u65B9\u5F0F" })), _jsx(View, Object.assign({ className: 'value' }, { children: "\u5FEB\u9012" }))] })), _jsxs(View, Object.assign({ className: 'coupon blcItem' }, { children: [_jsx(View, Object.assign({ className: 'label' }, { children: "\u4F7F\u7528\u4F18\u60E0" })), _jsxs(View, Object.assign({ className: 'value' }, { children: ["\u53EF\u9009\u62E9\u4F7F\u7528\u4F18\u60E0\u7801/\u4F18\u60E0\u7801", _jsx(Text, { className: 'icon' })] }))] }))] })), _jsxs(View, Object.assign({ className: 'price blcWrap' }, { children: [_jsx(View, Object.assign({ className: 'title' }, { children: "\u4EF7\u683C\u660E\u7EC6" })), _jsxs(View, Object.assign({ className: 'express blcItem' }, { children: [_jsx(View, Object.assign({ className: 'label' }, { children: "\u5546\u54C1\u603B\u91D1\u989D" })), _jsx(View, Object.assign({ className: 'value' }, { children: "\uFFE5 890" }))] })), _jsxs(View, Object.assign({ className: 'coupon blcItem' }, { children: [_jsx(View, Object.assign({ className: 'label' }, { children: "\u4F18\u60E0\u91D1\u989D" })), _jsx(View, Object.assign({ className: 'value' }, { children: "\u4E0D\u4F7F\u7528\u4F18\u60E0" }))] })), _jsxs(View, Object.assign({ className: 'express blcItem' }, { children: [_jsx(View, Object.assign({ className: 'label' }, { children: "\u8FD0\u8D39" })), _jsx(View, Object.assign({ className: 'value' }, { children: "\uFFE5 9000" }))] })), _jsxs(View, Object.assign({ className: 'all blcItem' }, { children: [_jsx(View, Object.assign({ className: 'label' }, { children: "\u603B\u8BA1" })), _jsx(View, Object.assign({ className: 'value', style: { color: '#000' } }, { children: "\uFFE5 9000" }))] }))] })), _jsxs(View, Object.assign({ className: 'placeOrderFooter' }, { children: [_jsx(Text, Object.assign({ className: 'price' }, { children: "\u5408\u8BA1: \uFFE517782.00" })), _jsx(View, Object.assign({ className: 'btn', onClick: () => navigatorImpl(routerMap.result) }, { children: "\u786E\u8BA4\u652F\u4ED8" }))] }))] })));
15
+ height: flag ? '100vh' : '667px'
16
+ } }, { children: [_jsx(View, Object.assign({ className: 'chooseAddress', onClick: () => navigatorImpl(routerMap.addressList) }, { children: _jsx(Address, { address: address }) })), _jsx(ShopJsx, { goodsList: list.current }), _jsxs(View, Object.assign({ className: 'info blcWrap' }, { children: [_jsxs(View, Object.assign({ className: 'express blcItem' }, { children: [_jsx(View, Object.assign({ className: 'label' }, { children: "\u914D\u9001\u65B9\u5F0F" })), _jsx(View, Object.assign({ className: 'value' }, { children: "\u5FEB\u9012" }))] })), _jsxs(View, Object.assign({ className: 'coupon blcItem' }, { children: [_jsx(View, Object.assign({ className: 'label' }, { children: "\u4F7F\u7528\u4F18\u60E0" })), _jsxs(View, Object.assign({ className: 'value' }, { children: ["\u53EF\u9009\u62E9\u4F7F\u7528\u4F18\u60E0\u7801/\u4F18\u60E0\u7801", _jsx(Text, { className: 'icon' })] }))] }))] })), _jsx(OrderPrice, { savePayPrice: savePayPrice, payState: payState.current })] })));
12
17
  };
13
18
  export const PlaceOrder = memo(PlaceOrderJsx);
@@ -0,0 +1,3 @@
1
+ export declare function useOrderResult(code: string): {
2
+ paymentImpl: () => Promise<void>;
3
+ };
@@ -0,0 +1,93 @@
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 } from 'react';
11
+ import { saveOrderToPay, syncContractState, paymentCommit } from '../../../utils/payment';
12
+ import { _ } from '@brushes/tools';
13
+ const { get } = _;
14
+ export function useOrderResult(code) {
15
+ const result = useRef({});
16
+ const amount = useRef(0);
17
+ useEffect(() => {
18
+ (() => __awaiter(this, void 0, void 0, function* () {
19
+ try {
20
+ const data = yield syncContractState({
21
+ contractBillcode: code
22
+ });
23
+ amount.current = get(data, 'dataObj.dataBmoney', 0);
24
+ const contractBillcode = get(data, 'dataObj.contractBillcode', '');
25
+ result.current = yield saveOrderToPay({
26
+ contractBillcode
27
+ });
28
+ console.log(result);
29
+ }
30
+ catch (err) {
31
+ console.log(err);
32
+ }
33
+ }))();
34
+ }, []);
35
+ const paymentImpl = () => __awaiter(this, void 0, void 0, function* () {
36
+ const { ptradeSeqno, contractBlance, payChannelList } = result.current;
37
+ // 模拟微信支付场景
38
+ const pyJsons = [
39
+ {
40
+ faccountIdType: 'ACCOUNT',
41
+ fchannelCode: payChannelList[1].fchannelCode,
42
+ orderAmount: amount.current,
43
+ faccountId: payChannelList[1].faccountOuterNo || ''
44
+ }
45
+ ];
46
+ try {
47
+ const res = yield paymentCommit({
48
+ ptradeSeqno,
49
+ payCommitStr: JSON.stringify(pyJsons),
50
+ contractBlance
51
+ });
52
+ console.log(51, res);
53
+ let data = res.dataObj.requestData;
54
+ console.log(data);
55
+ wx.requestPayment({
56
+ timeStamp: data.timeStamp,
57
+ nonceStr: data.nonceStr,
58
+ package: data.package,
59
+ signType: data.signType,
60
+ paySign: data.paySign,
61
+ success: function (res) {
62
+ console.log(64, res);
63
+ // http.post(syncContractPayState, {
64
+ // contractBillcode: $storage.get('contractBillcode')
65
+ // })
66
+ // .then(res => {
67
+ // if (res.success) {
68
+ // $router.replace('pay/paySuccess', {
69
+ // contractBillcode: $storage.get('contractBillcode')
70
+ // });
71
+ // } else {
72
+ // $router.replace('pay/payFail', {
73
+ // contractBillcode: $storage.get('contractBillcode')
74
+ // });
75
+ // }
76
+ // })
77
+ // .catch(err => {
78
+ // $message.alert('支付失败!');
79
+ // });
80
+ },
81
+ fail: function (res) {
82
+ console.log(res, '失败参数');
83
+ //$router.replace('pay/payFail')
84
+ },
85
+ complete: function (res) { }
86
+ });
87
+ }
88
+ catch (err) { }
89
+ });
90
+ return {
91
+ paymentImpl
92
+ };
93
+ }
@@ -1,2 +1,4 @@
1
1
  /// <reference types="react" />
2
- export declare const PlaceOrderResult: import("react").MemoExoticComponent<() => JSX.Element>;
2
+ export declare const PlaceOrderResult: import("react").MemoExoticComponent<({ code }: {
3
+ code: string;
4
+ }) => JSX.Element>;
@@ -3,11 +3,13 @@ import { memo } from 'react';
3
3
  import { navigatorImpl, useComponent } from '@brushes/qj-simulate-component';
4
4
  import { getEnv } from '@brushes/api';
5
5
  import { routerMap } from '../../routerMap';
6
+ import { useOrderResult } from './hooks/useOrderResult';
6
7
  const flag = getEnv();
7
- const PlaceOrderResultJsx = () => {
8
+ const PlaceOrderResultJsx = ({ code }) => {
8
9
  const { View, Text } = useComponent();
10
+ const { paymentImpl } = useOrderResult(code);
9
11
  return (_jsx(View, Object.assign({ className: 'placeOrderResult', style: {
10
- height: flag ? '100vh' : '600px'
11
- } }, { children: _jsxs(View, Object.assign({ className: 'placeOrderResultContent' }, { children: [_jsx(Text, { className: 'icon' }), _jsxs(View, Object.assign({ className: 'tips' }, { children: [_jsx(Text, Object.assign({ className: 'title' }, { children: "\u8BA2\u5355\u652F\u4ED8\u6210\u529F" })), _jsx(Text, Object.assign({ className: 'tip' }, { children: "\u60A8\u7684\u8BA2\u5355\u5C06\u4FDD\u755915\u5206\u949F\uFF0C\u53EF\u70B9\u51FB\u4E0B\u65B9\u201C\u53BB\u652F\u4ED8\u201D\u5B8C\u6210\u8BA2\u5355" }))] })), _jsxs(View, Object.assign({ className: 'placeOrderResultWrap' }, { children: [_jsxs(View, Object.assign({ className: 'placeOrderResultItem' }, { children: [_jsx(Text, Object.assign({ className: 'label' }, { children: "\u8BA2\u5355\u53F7\uFF1A" })), _jsx(Text, Object.assign({ className: 'value' }, { children: "324324823748237" }))] })), _jsxs(View, Object.assign({ className: 'placeOrderResultItem' }, { children: [_jsx(Text, Object.assign({ className: 'label' }, { children: "\u5546\u54C1\u6570\u91CF\uFF1A" })), _jsx(Text, Object.assign({ className: 'value' }, { children: "1" }))] })), _jsxs(View, Object.assign({ className: 'placeOrderResultItem' }, { children: [_jsx(Text, Object.assign({ className: 'label' }, { children: "\u652F\u4ED8\u65B9\u5F0F\uFF1A" })), _jsx(Text, Object.assign({ className: 'value' }, { children: "\u5FAE\u4FE1\u652F\u4ED8" }))] })), _jsxs(View, Object.assign({ className: 'placeOrderResultItem' }, { children: [_jsx(Text, Object.assign({ className: 'label' }, { children: "\u652F\u4ED8\u91D1\u989D\uFF1A" })), _jsx(Text, Object.assign({ className: 'value' }, { children: "\uFFE5 9999.00" }))] }))] })), _jsxs(View, Object.assign({ className: 'btnGroup' }, { children: [_jsx(View, Object.assign({ className: 'btn black', onClick: () => navigatorImpl(routerMap.orderDetail) }, { children: "\u67E5\u770B\u8BA2\u5355" })), _jsx(View, Object.assign({ className: 'btn white' }, { children: "\u7EE7\u7EED\u8D2D\u7269" }))] }))] })) })));
12
+ height: flag ? '100vh' : '667px'
13
+ } }, { children: _jsxs(View, Object.assign({ className: 'placeOrderResultContent' }, { children: [_jsx(Text, { className: 'icon' }), _jsxs(View, Object.assign({ className: 'tips' }, { children: [_jsx(Text, Object.assign({ className: 'title' }, { children: "\u8BA2\u5355\u652F\u4ED8\u6210\u529F" })), _jsx(Text, Object.assign({ className: 'tip' }, { children: "\u60A8\u7684\u8BA2\u5355\u5C06\u4FDD\u755915\u5206\u949F\uFF0C\u53EF\u70B9\u51FB\u4E0B\u65B9\u201C\u53BB\u652F\u4ED8\u201D\u5B8C\u6210\u8BA2\u5355" }))] })), _jsxs(View, Object.assign({ className: 'placeOrderResultWrap' }, { children: [_jsxs(View, Object.assign({ className: 'placeOrderResultItem' }, { children: [_jsx(Text, Object.assign({ className: 'label' }, { children: "\u8BA2\u5355\u53F7\uFF1A" })), _jsx(Text, Object.assign({ className: 'value' }, { children: "324324823748237" }))] })), _jsxs(View, Object.assign({ className: 'placeOrderResultItem' }, { children: [_jsx(Text, Object.assign({ className: 'label' }, { children: "\u5546\u54C1\u6570\u91CF\uFF1A" })), _jsx(Text, Object.assign({ className: 'value' }, { children: "1" }))] })), _jsxs(View, Object.assign({ className: 'placeOrderResultItem' }, { children: [_jsx(Text, Object.assign({ className: 'label' }, { children: "\u652F\u4ED8\u65B9\u5F0F\uFF1A" })), _jsx(Text, Object.assign({ className: 'value' }, { children: "\u5FAE\u4FE1\u652F\u4ED8" }))] })), _jsxs(View, Object.assign({ className: 'placeOrderResultItem' }, { children: [_jsx(Text, Object.assign({ className: 'label' }, { children: "\u652F\u4ED8\u91D1\u989D\uFF1A" })), _jsx(Text, Object.assign({ className: 'value' }, { children: "\uFFE5 9999.00" }))] }))] })), _jsxs(View, Object.assign({ className: 'btnGroup' }, { children: [_jsx(View, Object.assign({ className: 'btn black', onClick: () => navigatorImpl(routerMap.orderDetail) }, { children: "\u67E5\u770B\u8BA2\u5355" })), _jsx(View, Object.assign({ onClick: paymentImpl, className: 'btn white' }, { children: "\u7EE7\u7EED\u8D2D\u7269" }))] }))] })) })));
12
14
  };
13
15
  export const PlaceOrderResult = memo(PlaceOrderResultJsx);
@@ -1,10 +1,11 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { memo } from 'react';
3
- import { useComponent } from '@brushes/qj-simulate-component';
3
+ import { navigatorImpl, useComponent } from '@brushes/qj-simulate-component';
4
4
  import { SEARCH } from '../../static';
5
+ import { routerMap } from '../../routerMap';
5
6
  const SearchJsx = ({ value, iconShow, fontColor, backgroundColor, borderRadius, paddingTop, paddingBottom, paddingLeft, paddingRight }) => {
6
7
  const { View, Image } = useComponent();
7
- return (_jsx(View, Object.assign({ style: {
8
+ return (_jsx(View, Object.assign({ onClick: () => navigatorImpl(routerMap.search), style: {
8
9
  paddingTop,
9
10
  paddingBottom,
10
11
  paddingLeft,
@@ -1,19 +1,60 @@
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
+ };
1
10
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { memo } from 'react';
3
- import { navigatorImpl, useComponent } from '@brushes/qj-simulate-component';
11
+ import { memo, useEffect, useState } from 'react';
12
+ import { navigatorImpl, useComponent, navigatorBackImpl } from '@brushes/qj-simulate-component';
4
13
  import { SEARCH } from '../../static';
5
- import { getEnv } from '@brushes/api';
14
+ import { useImmutableCallback, _ } from '@brushes/tools';
15
+ import { getEnv, getTaro } from '@brushes/api';
6
16
  import { routerMap } from '../../routerMap';
17
+ import { QjMobileIcon } from '../../common/icon';
7
18
  const flag = getEnv();
8
- const fake = ['衣服', '裤子'];
19
+ const { isEmpty } = _;
9
20
  const SearchPageJsx = ({ placeholder, placeholderText, history }) => {
10
21
  const { View, Text } = useComponent();
11
- const searchGoodsImpl = (e) => {
22
+ const [historyItem, setHistory] = useState([]);
23
+ useEffect(() => {
24
+ (() => __awaiter(void 0, void 0, void 0, function* () {
25
+ const isTaro = getEnv();
26
+ if (!isTaro)
27
+ return;
28
+ const Taro = yield getTaro();
29
+ const history = Taro.getStorageSync('history') || [];
30
+ setHistory(history);
31
+ }))();
32
+ }, []);
33
+ const searchGoodsImpl = useImmutableCallback((e) => __awaiter(void 0, void 0, void 0, function* () {
12
34
  console.log(19, e.detail.value);
13
- navigatorImpl(`${routerMap.goodList}?searchParam=${e.detail.value}`);
14
- };
15
- return (_jsxs(View, Object.assign({ className: 'searchPage', style: { height: flag ? '100vh' : '600px' } }, { children: [_jsxs(View, Object.assign({ className: 'search-title' }, { children: [_jsx("img", { src: SEARCH, alt: "" }), _jsx("input", Object.assign({ "confirm-type": "search", type: "text", className: 'content', onConfirm: searchGoodsImpl }, (placeholder ? { placeholder: placeholderText } : {}))), _jsx(Text, Object.assign({ className: 'btn' }, { children: "\u53D6\u6D88" }))] })), history ? (_jsxs(View, Object.assign({ className: 'historyWrap' }, { children: [_jsxs(View, Object.assign({ className: 'title' }, { children: [_jsxs(View, Object.assign({ className: 'label' }, { children: [_jsx(View, { className: 'icon' }), "\u5386\u53F2\u641C\u7D22\u8BB0\u5F55"] })), _jsx(Text, Object.assign({ className: 'clear' }, { children: "\u6E05\u9664" }))] })), _jsx(View, Object.assign({ className: 'content' }, { children: fake.map((item, index) => {
16
- return (_jsx(View, Object.assign({ className: 'historyItem' }, { children: item }), index));
35
+ const isTaro = getEnv();
36
+ if (!isTaro)
37
+ return;
38
+ const Taro = yield getTaro();
39
+ setHistory((prevState) => {
40
+ if (isEmpty(e.detail.value))
41
+ return prevState;
42
+ const data = prevState.concat(e.detail.value);
43
+ Taro.getStorageSync('history', data);
44
+ return data;
45
+ });
46
+ navigatorHandler(e.detail.value);
47
+ }));
48
+ const navigatorHandler = useImmutableCallback((value) => {
49
+ navigatorImpl(`${routerMap.goodList}?searchParam=${value}`);
50
+ });
51
+ const removeHistory = () => __awaiter(void 0, void 0, void 0, function* () {
52
+ const Taro = yield getTaro();
53
+ Taro.removeStorageSync('history');
54
+ setHistory([]);
55
+ });
56
+ return (_jsxs(View, Object.assign({ className: 'searchPage', style: { height: flag ? '100vh' : '667px' } }, { children: [_jsxs(View, Object.assign({ className: 'search-title' }, { children: [_jsx("img", { src: SEARCH, alt: "" }), _jsx("input", Object.assign({ "confirm-type": "search", type: "text", className: 'content', onConfirm: searchGoodsImpl }, (placeholder ? { placeholder: placeholderText } : {}))), _jsx(Text, Object.assign({ className: 'btn', onClick: () => navigatorBackImpl() }, { children: "\u53D6\u6D88" }))] })), history ? (_jsxs(View, Object.assign({ className: 'historyWrap' }, { children: [_jsxs(View, Object.assign({ className: 'title' }, { children: [_jsxs(View, Object.assign({ className: 'label' }, { children: [_jsx(View, { className: 'icon' }), "\u5386\u53F2\u641C\u7D22\u8BB0\u5F55"] })), _jsx(QjMobileIcon, { onClick: removeHistory, value: 'shanchu', style: { fontSize: 18, color: '#222', lineHeight: '61px', cursor: 'pointer' } })] })), _jsx(View, Object.assign({ className: 'content' }, { children: historyItem.map((item, index) => {
57
+ return (_jsx(View, Object.assign({ onClick: () => navigatorHandler(item), className: 'historyItem' }, { children: item }), index));
17
58
  }) }))] }))) : null] })));
18
59
  };
19
60
  export const SearchPage = memo(SearchPageJsx);
@@ -1,2 +1,12 @@
1
1
  import React from 'react';
2
- export declare const Service: React.NamedExoticComponent<{}>;
2
+ interface ServiceType {
3
+ width: number;
4
+ height: number;
5
+ borderRadius: number;
6
+ top: number;
7
+ right: number;
8
+ bottom: number;
9
+ left: number;
10
+ }
11
+ export declare const Service: React.NamedExoticComponent<ServiceType>;
12
+ export {};
@@ -1,7 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { memo } from 'react';
3
- import { View } from '@brushes/qj-simulate-component';
4
- const ServiceJsx = () => {
5
- return _jsx(View, Object.assign({ className: 'components-service' }, { children: "123" }));
3
+ import { useComponent } from '@brushes/qj-simulate-component';
4
+ const ServiceJsx = ({ width, height, top, right, bottom, left, borderRadius }) => {
5
+ const { View } = useComponent();
6
+ return (_jsx(View, { style: { width, height, borderRadius, top, left, right, bottom }, className: 'components-service' }));
6
7
  };
7
8
  export const Service = memo(ServiceJsx);
@@ -26,3 +26,4 @@ export * from './PlaceOrderResult';
26
26
  export * from './CouponList';
27
27
  export * from './Cart';
28
28
  export * from './Mine';
29
+ export * from './PaymentMode';
@@ -26,3 +26,4 @@ export * from './PlaceOrderResult';
26
26
  export * from './CouponList';
27
27
  export * from './Cart';
28
28
  export * from './Mine';
29
+ export * from './PaymentMode';
@@ -1,2 +0,0 @@
1
- declare const options: any;
2
- export default options;
@@ -1,31 +1,36 @@
1
- import provinces from 'china-division/dist/provinces.json';
2
- import cities from 'china-division/dist/cities.json';
3
- import areas from 'china-division/dist/areas.json';
4
- console.log(5, provinces);
5
- areas.forEach((area) => {
6
- const matchCity = cities.filter((city) => city.code === area.cityCode)[0];
7
- if (matchCity) {
8
- matchCity.children = matchCity.children || [];
9
- matchCity.children.push({
10
- label: area.name,
11
- value: area.code
12
- });
13
- }
14
- });
15
- cities.forEach((city) => {
16
- const matchProvince = provinces.filter((province) => province.code === city.provinceCode)[0];
17
- if (matchProvince) {
18
- matchProvince.children = matchProvince.children || [];
19
- matchProvince.children.push({
20
- label: city.name,
21
- value: city.code,
22
- children: city.children
23
- });
24
- }
25
- });
26
- const options = provinces.map((province) => ({
27
- label: province.name,
28
- value: province.code,
29
- children: province.children
30
- }));
31
- export default options;
1
+ "use strict";
2
+ // import provinces from 'china-division/dist/provinces.json';
3
+ // import cities from 'china-division/dist/cities.json';
4
+ // import areas from 'china-division/dist/areas.json';
5
+ //
6
+ // console.log(5, provinces);
7
+ // areas.forEach((area) => {
8
+ // const matchCity = cities.filter((city) => city.code === area.cityCode)[0];
9
+ // if (matchCity) {
10
+ // matchCity.children = matchCity.children || [];
11
+ // matchCity.children.push({
12
+ // label: area.name,
13
+ // value: area.code
14
+ // });
15
+ // }
16
+ // });
17
+ //
18
+ // cities.forEach((city) => {
19
+ // const matchProvince = provinces.filter((province) => province.code === city.provinceCode)[0];
20
+ // if (matchProvince) {
21
+ // matchProvince.children = matchProvince.children || [];
22
+ // matchProvince.children.push({
23
+ // label: city.name,
24
+ // value: city.code,
25
+ // children: city.children
26
+ // });
27
+ // }
28
+ // });
29
+ //
30
+ // const options = provinces.map((province) => ({
31
+ // label: province.name,
32
+ // value: province.code,
33
+ // children: province.children
34
+ // }));
35
+ //
36
+ // export default options;
@@ -6,4 +6,11 @@ export declare const routerMap: {
6
6
  result: string;
7
7
  rate: string;
8
8
  search: string;
9
+ shopping: string;
10
+ confirm: string;
11
+ addressList: string;
12
+ addressEditor: string;
13
+ setting: string;
14
+ couponList: string;
15
+ paymentMode: string;
9
16
  };
@@ -5,5 +5,12 @@ export const routerMap = {
5
5
  goodDetail: '/subpackage/gooddetail/index',
6
6
  result: '/subpackage/result/index',
7
7
  rate: '/subpackage/rate/index',
8
- search: '/subpackage/search/index'
8
+ search: '/subpackage/search/index',
9
+ shopping: '/pages/shopping/index',
10
+ confirm: '/subpackage/orderconfirm/index',
11
+ addressList: '/subpackage/addresslist/index',
12
+ addressEditor: '/subpackage/addresseditor/index',
13
+ setting: '/subpackage/setting/index',
14
+ couponList: '/subpackage/couponlist/index',
15
+ paymentMode: '/subpackage/paymentmode/index'
9
16
  };
@@ -0,0 +1,14 @@
1
+ export { updateShoppingGoodsNum, // 更新购物车数量
2
+ queryShoppingToContract, // 购物车到订单
3
+ saveContract, // 增加订单服务
4
+ syncContractState, // 查询订单是否创建成功 (单条)
5
+ saveOrderToPay, // 获取支付方式
6
+ paymentCommit, // 开始支付
7
+ syncContractPayState, // 查看商品是否支付成功
8
+ calculateFreightFare, // 计算运费
9
+ getFalgSettingForPaydate, // 普通商品查询自动取消订单时间
10
+ queryAddressBymerberCode } from '@brushes/api';
11
+ export declare const checkSkuSpec: (spec: string, goodsCode: string) => Promise<any>;
12
+ export declare const addCardSku: (skuId: string, count: number) => Promise<any>;
13
+ export declare const queryToContractImpl: (skuId?: string, goodsNum?: number | string) => Promise<any>;
14
+ export declare const getTotalDiscountPriceImpl: (payloadNext: any) => Promise<any>;