xiaoe_mp_npm 1.0.6 → 1.0.7-alpha2

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 (271) hide show
  1. package/.gitlab-ci.yml +44 -44
  2. package/miniprogram_dist/ConfirmOrder/components/AddressSelect/index.js +160 -160
  3. package/miniprogram_dist/ConfirmOrder/components/ChoosePicker/index.js +115 -115
  4. package/miniprogram_dist/ConfirmOrder/components/ConfirmOrderContent/index.js +890 -890
  5. package/miniprogram_dist/ConfirmOrder/components/ConfirmOrderContent/index.json +23 -23
  6. package/miniprogram_dist/ConfirmOrder/components/ConfirmOrderContent/index.scss +44 -44
  7. package/miniprogram_dist/ConfirmOrder/components/ConfirmOrderContent/index.wxml +188 -188
  8. package/miniprogram_dist/ConfirmOrder/components/GoodsInfo/components/CopGoodsList/index.js +129 -129
  9. package/miniprogram_dist/ConfirmOrder/components/GoodsInfo/components/CopGoodsList/index.json +8 -8
  10. package/miniprogram_dist/ConfirmOrder/components/GoodsInfo/components/CopGoodsList/index.scss +58 -58
  11. package/miniprogram_dist/ConfirmOrder/components/GoodsInfo/components/CopGoodsList/index.wxml +25 -25
  12. package/miniprogram_dist/ConfirmOrder/components/GoodsInfo/index.js +448 -448
  13. package/miniprogram_dist/ConfirmOrder/components/GoodsInfo/index.json +9 -9
  14. package/miniprogram_dist/ConfirmOrder/components/GoodsInfo/index.scss +222 -222
  15. package/miniprogram_dist/ConfirmOrder/components/GoodsInfo/index.wxml +81 -81
  16. package/miniprogram_dist/ConfirmOrder/components/IntegralSelect/index.scss +90 -90
  17. package/miniprogram_dist/ConfirmOrder/components/Invoice/index.scss +60 -60
  18. package/miniprogram_dist/ConfirmOrder/components/LeaveWord/index.scss +39 -39
  19. package/miniprogram_dist/ConfirmOrder/components/PayBar/index.js +249 -249
  20. package/miniprogram_dist/ConfirmOrder/components/PayBar/index.scss +61 -61
  21. package/miniprogram_dist/ConfirmOrder/components/PayDetail/index.scss +40 -40
  22. package/miniprogram_dist/ConfirmOrder/components/PickupSelect/index.js +89 -89
  23. package/miniprogram_dist/ConfirmOrder/components/PickupSelect/index.wxml +13 -13
  24. package/miniprogram_dist/ConfirmOrder/components/SvipSelect/SvipSelect.js +99 -99
  25. package/miniprogram_dist/ConfirmOrder/components/SvipSelect/SvipSelect.json +6 -6
  26. package/miniprogram_dist/ConfirmOrder/components/SvipSelect/SvipSelect.scss +150 -150
  27. package/miniprogram_dist/ConfirmOrder/components/SvipSelect/SvipSelect.wxml +39 -39
  28. package/miniprogram_dist/ConfirmOrder/components/SvipSelect/filter.wxs +6 -6
  29. package/miniprogram_dist/ConfirmOrder/index.js +110 -110
  30. package/miniprogram_dist/CopGoodsCard/constans.js +462 -462
  31. package/miniprogram_dist/CopGoodsCard/index.js +147 -147
  32. package/miniprogram_dist/CopGoodsCard/index.json +2 -2
  33. package/miniprogram_dist/CopGoodsCard/index.scss +100 -100
  34. package/miniprogram_dist/CopGoodsCard/index.wxml +20 -20
  35. package/miniprogram_dist/CouponList/components/CouponItem/index.css +1715 -1715
  36. package/miniprogram_dist/CouponList/components/CouponItem/index.js +325 -319
  37. package/miniprogram_dist/CouponList/components/CouponItem/index.min.css +1 -1
  38. package/miniprogram_dist/CouponList/components/CouponItem/index.scss +591 -591
  39. package/miniprogram_dist/CouponList/components/CouponItem/index.wxml +199 -199
  40. package/miniprogram_dist/CouponList/couponColumn/index.js +176 -176
  41. package/miniprogram_dist/CouponList/couponColumn/index.scss +117 -117
  42. package/miniprogram_dist/CouponList/couponColumn/index.wxml +39 -39
  43. package/miniprogram_dist/CouponReceivePopup/index.js +72 -72
  44. package/miniprogram_dist/CouponReceivePopup/index.json +5 -5
  45. package/miniprogram_dist/CouponReceivePopup/index.scss +99 -99
  46. package/miniprogram_dist/CouponReceivePopup/index.wxml +85 -85
  47. package/miniprogram_dist/CustomPopup/index.js +82 -82
  48. package/miniprogram_dist/CustomPopup/index.wxml +25 -25
  49. package/miniprogram_dist/GoodsItem/index.js +745 -745
  50. package/miniprogram_dist/GoodsItem/index.scss +524 -524
  51. package/miniprogram_dist/GoodsItem/index.wxml +173 -173
  52. package/miniprogram_dist/GoodsItem/index.wxs +18 -18
  53. package/miniprogram_dist/GoodsRecommend/fun.wxs +37 -37
  54. package/miniprogram_dist/GoodsRecommend/index.js +91 -91
  55. package/miniprogram_dist/GoodsRecommend/index.json +3 -3
  56. package/miniprogram_dist/GoodsRecommend/index.less +129 -129
  57. package/miniprogram_dist/GoodsRecommend/index.scss +162 -162
  58. package/miniprogram_dist/GoodsRecommend/index.wxml +47 -47
  59. package/miniprogram_dist/LiveGoodsList/Header/index.scss +78 -78
  60. package/miniprogram_dist/LiveGoodsList/index.js +821 -821
  61. package/miniprogram_dist/LiveGoodsList/index.scss +92 -92
  62. package/miniprogram_dist/LiveGoodsList/index.wxml +106 -106
  63. package/miniprogram_dist/PayModule/button/index.scss +44 -44
  64. package/miniprogram_dist/PayModule/index/index.js +264 -264
  65. package/miniprogram_dist/Task/TaskBubble/index.js +117 -117
  66. package/miniprogram_dist/Task/TaskBubble/index.json +3 -3
  67. package/miniprogram_dist/Task/TaskBubble/index.scss +125 -125
  68. package/miniprogram_dist/Task/TaskBubble/index.wxml +22 -22
  69. package/miniprogram_dist/Task/TaskIcon/index.js +29 -29
  70. package/miniprogram_dist/Task/TaskIcon/index.json +4 -4
  71. package/miniprogram_dist/Task/TaskIcon/index.scss +70 -70
  72. package/miniprogram_dist/Task/TaskIcon/index.wxml +5 -5
  73. package/miniprogram_dist/Task/TaskPopup/component/RewardList/index.js +39 -39
  74. package/miniprogram_dist/Task/TaskPopup/component/RewardList/index.json +6 -6
  75. package/miniprogram_dist/Task/TaskPopup/component/RewardList/index.scss +39 -39
  76. package/miniprogram_dist/Task/TaskPopup/component/RewardList/index.wxml +19 -19
  77. package/miniprogram_dist/Task/TaskPopup/component/TaskItem/index.js +207 -207
  78. package/miniprogram_dist/Task/TaskPopup/component/TaskItem/index.json +5 -5
  79. package/miniprogram_dist/Task/TaskPopup/component/TaskItem/index.scss +139 -139
  80. package/miniprogram_dist/Task/TaskPopup/component/TaskItem/index.wxml +43 -43
  81. package/miniprogram_dist/Task/TaskPopup/component/TaskItem/index.wxs +7 -7
  82. package/miniprogram_dist/Task/TaskPopup/component/TaskList/index.js +146 -146
  83. package/miniprogram_dist/Task/TaskPopup/component/TaskList/index.json +7 -7
  84. package/miniprogram_dist/Task/TaskPopup/component/TaskList/index.scss +66 -66
  85. package/miniprogram_dist/Task/TaskPopup/component/TaskList/index.wxml +39 -39
  86. package/miniprogram_dist/Task/TaskPopup/component/TaskType/index.js +75 -75
  87. package/miniprogram_dist/Task/TaskPopup/component/TaskType/index.json +9 -9
  88. package/miniprogram_dist/Task/TaskPopup/component/TaskType/index.scss +59 -59
  89. package/miniprogram_dist/Task/TaskPopup/component/TaskType/index.wxml +42 -42
  90. package/miniprogram_dist/Task/TaskPopup/index.js +113 -113
  91. package/miniprogram_dist/Task/TaskPopup/index.json +8 -8
  92. package/miniprogram_dist/Task/TaskPopup/index.scss +113 -113
  93. package/miniprogram_dist/Task/TaskPopup/index.wxml +67 -67
  94. package/miniprogram_dist/Task/taskReceivePopup/coupon/index.js +52 -52
  95. package/miniprogram_dist/Task/taskReceivePopup/coupon/index.json +6 -6
  96. package/miniprogram_dist/Task/taskReceivePopup/coupon/index.scss +91 -91
  97. package/miniprogram_dist/Task/taskReceivePopup/coupon/index.wxml +53 -53
  98. package/miniprogram_dist/Task/taskReceivePopup/coupon/index.wxs +48 -48
  99. package/miniprogram_dist/Task/taskReceivePopup/index.js +30 -30
  100. package/miniprogram_dist/Task/taskReceivePopup/index.json +11 -11
  101. package/miniprogram_dist/Task/taskReceivePopup/index.wxml +18 -18
  102. package/miniprogram_dist/Task/taskReceivePopup/integral/index.js +37 -37
  103. package/miniprogram_dist/Task/taskReceivePopup/integral/index.json +6 -6
  104. package/miniprogram_dist/Task/taskReceivePopup/integral/index.scss +60 -60
  105. package/miniprogram_dist/Task/taskReceivePopup/integral/index.wxml +17 -17
  106. package/miniprogram_dist/TeacherGoodsList/index.js +825 -825
  107. package/miniprogram_dist/TeacherGoodsList/index.json +9 -9
  108. package/miniprogram_dist/TeacherGoodsList/index.scss +145 -145
  109. package/miniprogram_dist/TeacherGoodsList/index.wxml +110 -110
  110. package/miniprogram_dist/common/api/confirmOrder.js +223 -223
  111. package/miniprogram_dist/common/api/couponlist.js +2 -63
  112. package/miniprogram_dist/common/api/liveGoodsList.js +89 -89
  113. package/miniprogram_dist/common/api/sku.js +73 -73
  114. package/miniprogram_dist/common/utils/index.js +69 -69
  115. package/miniprogram_dist/coupon/components/CouponItem/index.less +208 -208
  116. package/miniprogram_dist/coupon/components/CouponItem/index.scss +246 -246
  117. package/miniprogram_dist/coupon/components/CouponSelect/index.scss +330 -330
  118. package/miniprogram_dist/coupon/index.js +248 -248
  119. package/miniprogram_dist/coupon/index.scss +83 -83
  120. package/package.json +78 -78
  121. package/src/ConfirmOrder/components/AddressSelect/index.js +160 -160
  122. package/src/ConfirmOrder/components/ChoosePicker/index.js +115 -115
  123. package/src/ConfirmOrder/components/ConfirmOrderContent/index.js +890 -890
  124. package/src/ConfirmOrder/components/ConfirmOrderContent/index.json +23 -23
  125. package/src/ConfirmOrder/components/ConfirmOrderContent/index.scss +44 -44
  126. package/src/ConfirmOrder/components/ConfirmOrderContent/index.wxml +188 -188
  127. package/src/ConfirmOrder/components/ConfirmOrderContent/index.wxss +51 -51
  128. package/src/ConfirmOrder/components/GoodsInfo/components/CopGoodsList/index.js +129 -129
  129. package/src/ConfirmOrder/components/GoodsInfo/components/CopGoodsList/index.json +8 -8
  130. package/src/ConfirmOrder/components/GoodsInfo/components/CopGoodsList/index.scss +58 -58
  131. package/src/ConfirmOrder/components/GoodsInfo/components/CopGoodsList/index.wxml +25 -25
  132. package/src/ConfirmOrder/components/GoodsInfo/components/CopGoodsList/index.wxss +1 -1
  133. package/src/ConfirmOrder/components/GoodsInfo/index.js +448 -448
  134. package/src/ConfirmOrder/components/GoodsInfo/index.json +9 -9
  135. package/src/ConfirmOrder/components/GoodsInfo/index.scss +222 -222
  136. package/src/ConfirmOrder/components/GoodsInfo/index.wxml +81 -81
  137. package/src/ConfirmOrder/components/GoodsInfo/index.wxss +673 -673
  138. package/src/ConfirmOrder/components/IntegralSelect/index.scss +90 -90
  139. package/src/ConfirmOrder/components/IntegralSelect/index.wxss +218 -218
  140. package/src/ConfirmOrder/components/Invoice/index.scss +60 -60
  141. package/src/ConfirmOrder/components/Invoice/index.wxss +93 -93
  142. package/src/ConfirmOrder/components/LeaveWord/index.scss +39 -39
  143. package/src/ConfirmOrder/components/LeaveWord/index.wxss +34 -34
  144. package/src/ConfirmOrder/components/PayBar/index.js +249 -249
  145. package/src/ConfirmOrder/components/PayBar/index.scss +61 -61
  146. package/src/ConfirmOrder/components/PayBar/index.wxss +108 -108
  147. package/src/ConfirmOrder/components/PayDetail/index.scss +40 -40
  148. package/src/ConfirmOrder/components/PayDetail/index.wxss +50 -50
  149. package/src/ConfirmOrder/components/PickupSelect/index.js +89 -89
  150. package/src/ConfirmOrder/components/PickupSelect/index.wxml +13 -13
  151. package/src/ConfirmOrder/components/SvipSelect/SvipSelect.js +99 -99
  152. package/src/ConfirmOrder/components/SvipSelect/SvipSelect.json +6 -6
  153. package/src/ConfirmOrder/components/SvipSelect/SvipSelect.scss +150 -150
  154. package/src/ConfirmOrder/components/SvipSelect/SvipSelect.wxml +39 -39
  155. package/src/ConfirmOrder/components/SvipSelect/SvipSelect.wxss +266 -266
  156. package/src/ConfirmOrder/components/SvipSelect/filter.wxs +6 -6
  157. package/src/ConfirmOrder/index.js +110 -110
  158. package/src/CopGoodsCard/constans.js +462 -462
  159. package/src/CopGoodsCard/index.js +147 -147
  160. package/src/CopGoodsCard/index.json +2 -2
  161. package/src/CopGoodsCard/index.scss +100 -100
  162. package/src/CopGoodsCard/index.wxml +20 -20
  163. package/src/CopGoodsCard/index.wxss +1 -1
  164. package/src/CouponList/components/CouponItem/index.css +1715 -1715
  165. package/src/CouponList/components/CouponItem/index.js +325 -319
  166. package/src/CouponList/components/CouponItem/index.min.css +1 -1
  167. package/src/CouponList/components/CouponItem/index.scss +591 -591
  168. package/src/CouponList/components/CouponItem/index.wxml +199 -199
  169. package/src/CouponList/components/CouponItem/index.wxss +1715 -1715
  170. package/src/CouponList/couponColumn/index.js +176 -176
  171. package/src/CouponList/couponColumn/index.scss +117 -117
  172. package/src/CouponList/couponColumn/index.wxml +39 -39
  173. package/src/CouponList/couponColumn/index.wxss +265 -265
  174. package/src/CouponReceivePopup/index.js +72 -72
  175. package/src/CouponReceivePopup/index.json +5 -5
  176. package/src/CouponReceivePopup/index.scss +99 -99
  177. package/src/CouponReceivePopup/index.wxml +85 -85
  178. package/src/CouponReceivePopup/index.wxss +1 -1
  179. package/src/CustomPopup/index.js +82 -82
  180. package/src/CustomPopup/index.wxml +25 -25
  181. package/src/GoodsItem/index.js +745 -745
  182. package/src/GoodsItem/index.scss +524 -524
  183. package/src/GoodsItem/index.wxml +173 -173
  184. package/src/GoodsItem/index.wxs +18 -18
  185. package/src/GoodsItem/index.wxss +1935 -1935
  186. package/src/GoodsRecommend/fun.wxs +37 -37
  187. package/src/GoodsRecommend/index.js +91 -91
  188. package/src/GoodsRecommend/index.json +3 -3
  189. package/src/GoodsRecommend/index.less +129 -129
  190. package/src/GoodsRecommend/index.scss +162 -162
  191. package/src/GoodsRecommend/index.wxml +47 -47
  192. package/src/GoodsRecommend/index.wxss +537 -537
  193. package/src/LiveGoodsList/Header/index.scss +78 -78
  194. package/src/LiveGoodsList/Header/index.wxss +190 -190
  195. package/src/LiveGoodsList/index.js +821 -821
  196. package/src/LiveGoodsList/index.scss +92 -92
  197. package/src/LiveGoodsList/index.wxml +106 -106
  198. package/src/LiveGoodsList/index.wxss +230 -230
  199. package/src/PayModule/button/index.scss +44 -44
  200. package/src/PayModule/button/index.wxss +58 -58
  201. package/src/PayModule/index/index.js +264 -264
  202. package/src/Sku/commSelect/index.wxss +54 -54
  203. package/src/Task/TaskBubble/index.js +117 -117
  204. package/src/Task/TaskBubble/index.json +3 -3
  205. package/src/Task/TaskBubble/index.scss +125 -125
  206. package/src/Task/TaskBubble/index.wxml +22 -22
  207. package/src/Task/TaskBubble/index.wxss +289 -289
  208. package/src/Task/TaskIcon/index.js +29 -29
  209. package/src/Task/TaskIcon/index.json +4 -4
  210. package/src/Task/TaskIcon/index.scss +70 -70
  211. package/src/Task/TaskIcon/index.wxml +5 -5
  212. package/src/Task/TaskIcon/index.wxss +130 -130
  213. package/src/Task/TaskPopup/component/RewardList/index.js +39 -39
  214. package/src/Task/TaskPopup/component/RewardList/index.json +6 -6
  215. package/src/Task/TaskPopup/component/RewardList/index.scss +39 -39
  216. package/src/Task/TaskPopup/component/RewardList/index.wxml +19 -19
  217. package/src/Task/TaskPopup/component/RewardList/index.wxss +18 -18
  218. package/src/Task/TaskPopup/component/TaskItem/index.js +207 -207
  219. package/src/Task/TaskPopup/component/TaskItem/index.json +5 -5
  220. package/src/Task/TaskPopup/component/TaskItem/index.scss +139 -139
  221. package/src/Task/TaskPopup/component/TaskItem/index.wxml +43 -43
  222. package/src/Task/TaskPopup/component/TaskItem/index.wxs +7 -7
  223. package/src/Task/TaskPopup/component/TaskItem/index.wxss +394 -394
  224. package/src/Task/TaskPopup/component/TaskList/index.js +146 -146
  225. package/src/Task/TaskPopup/component/TaskList/index.json +7 -7
  226. package/src/Task/TaskPopup/component/TaskList/index.scss +66 -66
  227. package/src/Task/TaskPopup/component/TaskList/index.wxml +39 -39
  228. package/src/Task/TaskPopup/component/TaskList/index.wxss +118 -118
  229. package/src/Task/TaskPopup/component/TaskType/index.js +75 -75
  230. package/src/Task/TaskPopup/component/TaskType/index.json +9 -9
  231. package/src/Task/TaskPopup/component/TaskType/index.scss +59 -59
  232. package/src/Task/TaskPopup/component/TaskType/index.wxml +42 -42
  233. package/src/Task/TaskPopup/component/TaskType/index.wxss +98 -98
  234. package/src/Task/TaskPopup/index.js +113 -113
  235. package/src/Task/TaskPopup/index.json +8 -8
  236. package/src/Task/TaskPopup/index.scss +113 -113
  237. package/src/Task/TaskPopup/index.wxml +67 -67
  238. package/src/Task/TaskPopup/index.wxss +306 -306
  239. package/src/Task/taskReceivePopup/coupon/index.js +52 -52
  240. package/src/Task/taskReceivePopup/coupon/index.json +6 -6
  241. package/src/Task/taskReceivePopup/coupon/index.scss +91 -91
  242. package/src/Task/taskReceivePopup/coupon/index.wxml +53 -53
  243. package/src/Task/taskReceivePopup/coupon/index.wxs +48 -48
  244. package/src/Task/taskReceivePopup/coupon/index.wxss +187 -187
  245. package/src/Task/taskReceivePopup/index.js +30 -30
  246. package/src/Task/taskReceivePopup/index.json +11 -11
  247. package/src/Task/taskReceivePopup/index.wxml +18 -18
  248. package/src/Task/taskReceivePopup/index.wxss +1 -1
  249. package/src/Task/taskReceivePopup/integral/index.js +37 -37
  250. package/src/Task/taskReceivePopup/integral/index.json +6 -6
  251. package/src/Task/taskReceivePopup/integral/index.scss +60 -60
  252. package/src/Task/taskReceivePopup/integral/index.wxml +17 -17
  253. package/src/Task/taskReceivePopup/integral/index.wxss +94 -94
  254. package/src/TeacherGoodsList/index.js +825 -825
  255. package/src/TeacherGoodsList/index.json +9 -9
  256. package/src/TeacherGoodsList/index.scss +145 -145
  257. package/src/TeacherGoodsList/index.wxml +110 -110
  258. package/src/TeacherGoodsList/index.wxss +196 -196
  259. package/src/common/api/confirmOrder.js +223 -223
  260. package/src/common/api/couponlist.js +2 -63
  261. package/src/common/api/liveGoodsList.js +89 -89
  262. package/src/common/api/sku.js +73 -73
  263. package/src/common/utils/index.js +69 -69
  264. package/src/coupon/components/CouponItem/index.less +208 -208
  265. package/src/coupon/components/CouponItem/index.scss +246 -246
  266. package/src/coupon/components/CouponItem/index.wxss +821 -821
  267. package/src/coupon/components/CouponSelect/index.scss +330 -330
  268. package/src/coupon/components/CouponSelect/index.wxss +1132 -1132
  269. package/src/coupon/index.js +248 -248
  270. package/src/coupon/index.scss +83 -83
  271. package/src/coupon/index.wxss +216 -216
@@ -1,891 +1,891 @@
1
- // src/ConfirmOrder/components/ConfirmOrderContent/index.js
2
- import {
3
- getConfirmOrderDetail,
4
- getExpressSwitch,
5
- getPickerInfo,
6
- getGoodsPackage,
7
- getSuperVipInfo,
8
- getBusinessFeature,
9
- getMarketingInfo,
10
- getPrePayInfoV3,
11
- getShopConf
12
- } from "../../../common/api/confirmOrder"
13
- import {
14
- isEmptyObject
15
- } from "../../../common/utils/index"
16
- import {
17
- postCouponList
18
- } from "../../../common/utils/postCouponList"
19
- import {
20
- MEMBER,
21
- SPECIAL_COLUMN,
22
- BIG_SPECIAL_COLUMN,
23
- TRAINING_CAMP,
24
- SVIP
25
- } from "../../../common/utils/constants.js";
26
- import {
27
- debounce
28
- } from "../../../common/utils/tool.js"
29
- const computedBehavior = require('miniprogram-computed').behavior
30
-
31
- Component({
32
- behaviors: [computedBehavior],
33
- /**
34
- * 组件的属性列表
35
- */
36
- properties: {
37
- baseInfoQuery: {
38
- type: Object,
39
- value: () => {},
40
- },
41
- isCart: {
42
- type: Number,
43
- value: 0,
44
- },
45
- isTeam: {
46
- type: Boolean,
47
- default: false,
48
- },
49
- aliveInfo:{
50
- type: Object,
51
- value:{}
52
- },
53
- sensorReportParams:{
54
- type: Object,
55
- value:{}
56
- },
57
- popPosition: {
58
- type: String,
59
- value: 'bottom'
60
- },
61
- round:{
62
- type:Boolean,
63
- value: true
64
- },
65
- showClose:{
66
- type:Boolean,
67
- value: true
68
- },
69
- invoiceSelectZIndex:{
70
- type: Number,
71
- value: 100
72
- },
73
- invoiceTipZIndex:{
74
- type: Number,
75
- value: 100
76
- },
77
- zIndex:{
78
- type: Number,
79
- value: 100
80
- },
81
- },
82
-
83
- /**
84
- * 组件的初始数据
85
- */
86
- data: {
87
- activeMode: 0, // 0:快递配送,1:自提
88
- express_type: 0, // 接口下发配送信息 1-快递配送 2-商品自提
89
- userCanPick: 1, // 商家是否支持自提 1支持 0不支持
90
- shopConf: {},
91
- confirmOrderInfo: {
92
- // 订单页详细信息(通过查询接口拿到)
93
- app_info: {},
94
- goods_info: {},
95
- },
96
- distributionMode: 0, // 配送方式 -1全部 1快递配送 2商品自提 (目前只支持实物商品,非实物商品返回0)
97
- resource_id: "",
98
- addressInfo: {}, // 地址信息(非自提)
99
- pickerUserInfo: {}, // 自提人信息
100
- picksiteInfo:{}, //自提点信息
101
- hasEntityGoods: false, // 商品套餐是否包含实物商品
102
- superVipInfo: {}, // 超级会员信息
103
- businessConf: {},
104
- marketingData: {}, //营销数据
105
- isShowPoint: false, // 是否显示选择提货点组件
106
- isShowSelectShipper: false, // 是否显示选择提货人组件
107
- isShowCreateShipper: false, // 是否显示新增、编辑提货人组件
108
- isShowAddressManage: false, // 是否显示地址管理组件(非自提)
109
- isShowEditAddress: false, // 是否显示新建、编辑组件(非自提)
110
- addressQuery: {}, // 地址相关组件需要的入参
111
- marketingDataLoaded: false, //营销数据加载
112
- cartInfoLoaded: false, //购物车数据加载
113
- addressInfoLoaded: false, //地址信息加载
114
- backType: 0, // 弹框顶部返回按钮操作
115
- backPage: 1, // 1:确认订单页面大组件
116
- shipperType: 1, // 1:新建自提人;2:编辑自提人
117
- checkList: {}, // 支付前校验信息
118
- beforePay: {}, // 支付前校验函数
119
- afterPay: {}, // 支付后的参数
120
- afterPayCallback: {}, // 支付后回调
121
- payParams: {},
122
- prePayParams: {}, //批价信息参数
123
- getPrePayInfoReset: null, // 批价防抖函数回调
124
- //错误信息
125
- errMsg: {
126
- 10309: "该商品已售罄",
127
- 30201: "商家未设置支付方式,请联系商家处理",
128
- 30202: "支付失败,请联系商家处理",
129
- 10029: "已拥有,不可重复购买",
130
- 10067: "该商品已下架,不支持继续购买!",
131
- 10100: "该商品可能已下架或价格变更,请稍后再试。",
132
- 10306: "拼团失败,请刷新重试。",
133
- 10308: "活动即将开始",
134
- 10310: "商家正努力补货中",
135
- 10312: "未预约该活动",
136
- 20012: "购买数量超过活动限制。",
137
- 20020: "该团已满,请重新下单。",
138
- 20021: "该活动已结束。",
139
- 20011: "您已参与本团,不可重复参与。",
140
- 20077: "配送区域已更新,此收货地址超出配送范围,请重新选择",
141
- 20023: "单笔订单最多可购买1000件",
142
- },
143
- },
144
-
145
- options: {
146
- addGlobalClass: true
147
- },
148
-
149
- lifetimes: {
150
- attached: async function () {
151
- // 在组件实例进入页面节点树时执行
152
- // 初始化数据
153
- this.initData();
154
- if (this.data.baseInfoQuery?.isCollectCoupons) {
155
- const {
156
- resource_id,
157
- resource_type,
158
- spu_id
159
- } = this.data.baseInfoQuery
160
- await postCouponList(spu_id || resource_id, resource_type).then(() => {
161
- wx.showToast({
162
- title: '您已享有最佳优惠,下单更优惠~',
163
- icon: 'none',
164
- duration: 2000
165
- })
166
- }).catch((err) => {
167
- console.log("优惠券获取列表报错或者没有可领券", err)
168
- })
169
- }
170
- },
171
- },
172
- computed: {
173
- // 是否全屏
174
- isFullScreen(properties) {
175
- return properties.popPosition === 'right'
176
- },
177
- isShowMain(data) {
178
- return (
179
- !data.isShowPoint &&
180
- !data.isShowSelectShipper &&
181
- !data.isShowCreateShipper &&
182
- !data.isShowAddressManage &&
183
- !data.isShowEditAddress
184
- )
185
- },
186
- //判断模式选择tab栏的显示和隐藏
187
- showModeSelect(data) {
188
- return data.distributionMode === -1 && data.userCanPick === 1;
189
- },
190
- // 显示地址栏的情况 商品有两种配送方式,商家关闭自提/购物车
191
- showAddressSelect(data) {
192
- return (
193
- data.activeMode === 0 &&
194
- (data.distributionMode === -1 || data.distributionMode === 1)
195
- );
196
- },
197
- // 商品信息
198
- goodsInfo(data) {
199
- if (isEmptyObject(data.confirmOrderInfo.goods_info)) {
200
- return data.baseInfoQuery;
201
- }
202
- return data.confirmOrderInfo.goods_info;
203
- },
204
- //通过商家是否开启自提和自提选择 决定自提组件的显示和隐藏
205
- showPickSelf(data) {
206
- return (
207
- data.userCanPick === 1 &&
208
- (data.activeMode === 1 || data.distributionMode === 2)
209
- );
210
- },
211
- // 公共批价请求参数
212
- commonPrePayParams(data) {
213
- let spuType = data.baseInfoQuery.spu_type;
214
- let coursePackage = [
215
- MEMBER,
216
- SPECIAL_COLUMN,
217
- BIG_SPECIAL_COLUMN,
218
- TRAINING_CAMP,
219
- ];
220
- let paymentType15 = [SVIP]
221
- let paymentType = 2;
222
- if (coursePackage.includes(spuType)) {
223
- paymentType = 3;
224
- }
225
- if (paymentType15.includes(spuType)) {
226
- paymentType = 15;
227
- }
228
- return {
229
- pre_pay_type: data.baseInfoQuery.pre_pay_type || 1,
230
- resource_id: data.baseInfoQuery.resource_id,
231
- spu_id: data.baseInfoQuery.id,
232
- count: data.baseInfoQuery.count,
233
- // product_id: data.baseInfoQuery.id,
234
- product_id: '',
235
- resource_type: data.baseInfoQuery.resource_type,
236
- spu_type: spuType,
237
- payment_type: paymentType,
238
- sku_id: data.baseInfoQuery.sku,
239
- };
240
- },
241
- // 通过请求获取的批价参数是否都已加载完毕
242
- prePayParamsInfoLoaded(data) {
243
- return (
244
- ((data.marketingDataLoaded && !data.isCart) ||
245
- (data.isCart && data.cartInfoLoaded)) &&
246
- (data.addressInfoLoaded ||
247
- Object.keys(data.pickerUserInfo).length > 0 ||
248
- data.activeMode === 0)
249
- //加入商品自提后,这里判断是否加载完自提人消息来确定批价参数是否加载完毕
250
- //每次切换提货模式时也要触发商品批价信息
251
- );
252
- },
253
- },
254
- observers: {
255
- distributionMode(val) {
256
- if (val === 1) {
257
- this.setData({
258
- express_type: val
259
- })
260
- } else if (val === 2) {
261
- this.setData({
262
- express_type: val
263
- })
264
- }else if (val === 0) {
265
- this.setData({
266
- express_type: val
267
- })
268
- }else if (val === -1) {
269
- this.setData({
270
- express_type: 1
271
- })
272
- }
273
- },
274
- marketingData(marketingData) {
275
- // 这里的逻辑应该是存在拼团的时候那么payment_type就要赋值为13,如果是限时折扣或者是单买的话,payment_type不做赋值默认为2
276
- if (
277
- marketingData &&
278
- marketingData.payment_type &&
279
- this.data.isTeam === "true"
280
- ) {
281
- this.payInfoChange({
282
- name: "marketingData",
283
- prePayParams: {
284
- payment_type: marketingData.payment_type,
285
- },
286
- });
287
- }
288
- this.setData({
289
- marketingDataLoaded: true
290
- })
291
- },
292
- isShowCreateShipper(val) {
293
- if (val) {
294
- if (this.data.shipperType === 1) {
295
- this.triggerEvent("changeSheetInfo", {
296
- title: "新建提货人",
297
- })
298
- } else {
299
- this.triggerEvent("changeSheetInfo", {
300
- title: "编辑提货人",
301
- })
302
- }
303
- this.triggerEvent("changeSheetInfo", {
304
- showClose: false,
305
- showBack: true,
306
- })
307
- this.setData({
308
- backType: 3
309
- })
310
- } else {
311
- this.backClick();
312
- }
313
- },
314
- showPickSelf(val) {
315
- if (!val) {
316
- this.payInfoChange({
317
- name: "pickerUserInfo",
318
- errMsg: "",
319
- });
320
- this.payInfoChange({
321
- name: "address",
322
- errMsg: "",
323
- });
324
- }
325
- },
326
- isShowSelectShipper: function (newData) {
327
- if (newData) {
328
- this.triggerEvent("changeSheetInfo", {
329
- title: "选择提货人",
330
- showClose: false,
331
- showBack: true,
332
- })
333
- this.setData({
334
- backType: 2
335
- })
336
- } else {
337
- this.backClick();
338
- }
339
- },
340
- isShowAddressManage(newData) {
341
- if (newData) {
342
- this.triggerEvent("changeSheetInfo", {
343
- title: "选择地址",
344
- showClose: false,
345
- showBack: true,
346
- })
347
- this.setData({
348
- backType: 4
349
- })
350
- } else {
351
- if (!this.data.isShowEditAddress) {
352
- this.backClick()
353
- }
354
- }
355
- },
356
- isShowEditAddress(newData) {
357
- if (newData) {
358
- this.triggerEvent("changeSheetInfo", {
359
- title: "地址编辑",
360
- showClose: false,
361
- showBack: true,
362
- })
363
- this.setData({
364
- backType: 5
365
- })
366
- } else {
367
- this.backClick()
368
- }
369
- },
370
- isShowPoint: function (newData) {
371
- if (newData) {
372
- this.triggerEvent("changeSheetInfo", {
373
- title: "提货地址",
374
- showClose: false,
375
- showBack: true,
376
- })
377
- this.setData({
378
- backType: 1
379
- })
380
- } else {
381
- this.backClick();
382
- }
383
- },
384
- prePayParamsInfoLoaded(val) {
385
- if (val) {
386
- let obj = {
387
- ...this.data.commonPrePayParams,
388
- ...this.data.prePayParams,
389
- }
390
- this.setData({
391
- getPrePayInfoReset: this.getPrePayInfo(obj)
392
- })
393
- }
394
- },
395
- },
396
- /**
397
- * 组件的方法列表
398
- */
399
- methods: {
400
- // 初始化店铺设置信息
401
- initShopConf() {
402
- getShopConf().then(res => {
403
- if (res.data.code === 0) {
404
- this.setData({
405
- shopConf: res.data.data
406
- })
407
- }
408
- })
409
- },
410
- // 做防抖处理,避免短时间触发多次批价
411
- getPrePayInfo: debounce(function (payload) {
412
- // console.log("val: ", val);
413
- // let payload = val[0]
414
- if (!payload["resource_id"]) {
415
- payload = {
416
- ...payload,
417
- resource_id: this.data.resource_id,
418
- };
419
- }
420
- this.setData({
421
- prePayParams: payload
422
- })
423
- wx.showLoading({
424
- mask: true,
425
- title: '加载中'
426
- })
427
- return getPrePayInfoV3(payload).then(res => {
428
- wx.hideLoading()
429
- if (res.data.code === 0) {
430
- this.setData({
431
- prePayInfo: res.data.data
432
- })
433
- } else {
434
- this.handlePreErrorCode(res.data);
435
- }
436
- if (wx.getStorageSync('toastWarn')) {
437
- wx.showToast({
438
- title: "单笔订单最多可购买1000件",
439
- icon: 'none',
440
- duration: 2000
441
- })
442
- setTimeout(() => {
443
- wx.removeStorage({
444
- key: "toastWarn"
445
- })
446
- }, 3000)
447
- }
448
- if (res.data.code === 10310 || res.data.code === 10309) {
449
- this.setData({
450
- ["checkList.order"]: "商家努力补货中"
451
- })
452
- } else {
453
- this.setData({
454
- ["checkList.order"]: ""
455
- })
456
- }
457
- }).catch((err) => console.log(err))
458
- }, 1000),
459
- handlePreErrorCode(res) {
460
- if (res.code !== 20077) {
461
- this.handleErrorCode(res);
462
- }
463
- },
464
- handleErrorCode(res) {
465
- // 重复支付错误code特殊逻辑,不做toast处理,弹窗处理
466
- if (res.code === 20022) {
467
- return;
468
- }
469
-
470
- if (res.code === 10061001) {
471
- wx.showToast({
472
- title: "订单信息有变化, 请刷新后重试",
473
- icon: 'none',
474
- duration: 2000
475
- })
476
- setTimeout(() => {
477
- this.onLoad()
478
- }, 1000);
479
- return;
480
- }
481
- wx.showToast({
482
- title: this.data.errMsg[res.code] || res.msg,
483
- icon: 'none',
484
- duration: 2000
485
- })
486
- },
487
- /**
488
- * @description: 支付参数改变事件,用于约束各业务测支付参数传参
489
- * @param {string} data.name 业务侧名称,用于区分各业务侧参数
490
- * @param {string} data.errMsg [同步校验]业务侧参数提示信息,用于支付前判断,目前主要用于判空提示(若为disabled标明只禁止提交,不弹提示。如信息采集,必须等信息采集加载完才能进行提交)
491
- * @param {promise} data.beforePay [异步校验]业务侧用于进行支付前校验的校验方法, 这里为一个function,并返回一个Promise,resolve返回校验成功true或者校验失败false
492
- * @param {object} data.prePayParams 业务侧涉及的批价参数,当有此参数时,会触发重新批价
493
- * @param {object} data.payParams 业务侧涉及的支付参数,用于支付时传参
494
- * @param {object} data.afterPay 业务侧支付后使用的一些参数 callBack: 支付完成后回调,支付完成后就只执行此回调方法,回调可返回支付完成后的跳转页面;
495
- * srcUrl:支付失败跳转页面;backUrl: 支付成功跳转页面
496
- * @param {Boolean} data.triggerPrePay 本次修改是否触发批价
497
- */
498
- payInfoChange(val) {
499
- let data = {};
500
- val.detail ? data = val.detail : data = val
501
- this.setData({
502
- [`checkList.${data.name}`]: data.errMsg || ""
503
- })
504
- if (data.beforePay) {
505
- this.setData({
506
- [`beforePay.${data.name}`]: data.beforePay
507
- })
508
- }
509
- if (data.afterPay) {
510
- let {
511
- callBack,
512
- ...others
513
- } = data.afterPay;
514
- this.setData({
515
- afterPay: {
516
- ...this.data.afterPay,
517
- ...others,
518
- }
519
- })
520
- if (callBack) {
521
- this.setData({
522
- [`afterPayCallback.${data.name}`]: callBack
523
- })
524
- }
525
- }
526
- // 支付参数处理
527
- if (data.payParams) {
528
- this.setData({
529
- payParams: {
530
- ...this.data.payParams,
531
- ...data.payParams,
532
- }
533
- })
534
- }
535
- if (data.prePayParams) {
536
- // 更新业务批价参数
537
- this.setData({
538
- prePayParams: {
539
- ...this.data.prePayParams,
540
- ...data.prePayParams,
541
- }
542
- })
543
- if (this.data.prePayParamsInfoLoaded && data.triggerPrePay !== false) {
544
- let obj = {
545
- ...this.data.commonPrePayParams,
546
- ...this.data.prePayParams,
547
- }
548
- this.setData({
549
- getPrePayInfoReset: this.getPrePayInfo(obj)
550
- })
551
- }
552
- }
553
- },
554
- // 返回箭头点击事件
555
- backClick() {
556
- switch (this.data.backType) {
557
- case 1:
558
- this.triggerEvent("changeSheetInfo", {
559
- title: "确认订单",
560
- showClose: true,
561
- showBack: false,
562
- })
563
- this.setData({
564
- isShowPoint: false,
565
- backType: 0
566
- })
567
- break;
568
- case 2:
569
- this.triggerEvent("changeSheetInfo", {
570
- title: "确认订单",
571
- showClose: true,
572
- showBack: false,
573
- })
574
- this.setData({
575
- isShowSelectShipper: false,
576
- backType: 0
577
- })
578
- break;
579
- case 3:
580
- if (this.data.backPage === 1) {
581
- this.triggerEvent("changeSheetInfo", {
582
- title: "确认订单",
583
- showBack: false,
584
- });
585
- } else {
586
- this.setData({
587
- isShowSelectShipper: true,
588
- })
589
- this.triggerEvent("changeSheetInfo", {
590
- title: "选择提货人",
591
- showBack: true,
592
- });
593
- }
594
- this.triggerEvent("changeSheetInfo", {
595
- showClose: true,
596
- });
597
- this.setData({
598
- isShowCreateShipper: false,
599
- backType: 0
600
- })
601
- break;
602
- case 4:
603
- this.setData({
604
- isShowAddressManage: false,
605
- backType: 0
606
- })
607
- this.triggerEvent("changeSheetInfo", {
608
- title: "确认订单",
609
- showClose: true,
610
- showBack: false,
611
- })
612
- break;
613
- case 5:
614
- this.setData({
615
- isShowEditAddress: false,
616
- backType: 0
617
- })
618
- this.triggerEvent("changeSheetInfo", {
619
- title: "确认订单",
620
- showClose: true,
621
- showBack: false,
622
- })
623
- break;
624
- }
625
- },
626
- // 供子组件修改父组件值
627
- updataData(e) {
628
- this.setData({
629
- ...e.detail
630
- })
631
- },
632
- async handleInfo() {
633
- let result = await this.initConfirmOrderInfo();
634
- this.handleOrderInfo(result);
635
- wx.hideLoading()
636
- },
637
- // 初始化数据,请求相应接口
638
- async initData() {
639
- if (!this.data.shopConf || isEmptyObject(this.data.shopConf)) {
640
- // 页面刷新重新初始化店铺设置信息
641
- this.initShopConf();
642
- }
643
- let result = await this.initConfirmOrderInfo();
644
- this.handleOrderInfo(result);
645
- this.initDeliveryState();
646
- this.initPickerInfo();
647
- this.initGoodsPackage();
648
- this.initSuperVipInfo();
649
- this.initBusinessFeatureConf();
650
- if (!this.data.isCart) {
651
- this.initMarketingData();
652
- }
653
- },
654
- // 获取营销活动信息
655
- initMarketingData() {
656
- wx.showLoading({
657
- mask: true,
658
- title: '加载中'
659
- })
660
- let params = {
661
- spu_id: this.data.baseInfoQuery.id,
662
- spu_type: this.data.baseInfoQuery.spu_type,
663
- resource_type: this.data.baseInfoQuery.resource_type,
664
- }
665
- getMarketingInfo(params).then(val => {
666
- let res = val.data;
667
- if (res.code === 0) {
668
- let marketing_info = res.data.marketing_info;
669
- if (
670
- marketing_info?.activity_type === 3 &&
671
- !(
672
- (marketing_info?.all_stock > 0 &&
673
- marketing_info?.now_stock > 0) ||
674
- marketing_info?.all_stock == 0
675
- ) &&
676
- ![21, 29, 41, 42].includes(marketing_info.resource_type)
677
- ) {
678
- // 这里的逻辑要注意,如果接口返回了营销信息但工程拿不到的话,问题就在这里。
679
- // 如果是限时折扣,且达到了限量后,就应该不显示限时折扣的信息了,我选择在源头就断了这个数据,但保留了推广员的信息
680
- // 且这里不能是多规格的商品,因为多规格的商品没有限量的设置,如果你看到的时候已经准备有了,麻烦跟产品说这需求咱不接,咱不受这鸟气
681
- res.data.marketing_info = null;
682
- }
683
- this.setData({
684
- marketingData: res.data
685
- })
686
- } else {
687
- this.setData({
688
- marketingDataLoaded: true
689
- })
690
- }
691
- }).catch((err) => console.log(err))
692
- .finally(() => {
693
- // // wx.hideLoading()
694
- })
695
- },
696
- // 业务特性信息
697
- initBusinessFeatureConf() {
698
- wx.showLoading({
699
- mask: true,
700
- title: '加载中'
701
- })
702
- let params = {
703
- spu_id: this.data.baseInfoQuery.id
704
- }
705
- getBusinessFeature(params).then(res => {
706
- if (res.data.code === 0) {
707
- this.setData({
708
- businessConf: res.data.data
709
- })
710
- }
711
- }).catch((err) => console.log(err))
712
- .finally(() => {
713
- // wx.hideLoading()
714
- })
715
- },
716
- // 获取超级会员相关信息
717
- initSuperVipInfo() {
718
- wx.showLoading({
719
- mask: true,
720
- title: '加载中'
721
- })
722
- let params = {
723
- resource_id: this.data.baseInfoQuery.resource_id || this.data.resource_id,
724
- resource_type: this.data.baseInfoQuery.resource_type,
725
- };
726
- getSuperVipInfo(params).then(res => {
727
- if (res.data.code === 0) {
728
- this.setData({
729
- superVipInfo: res.data.data
730
- })
731
- }
732
- }).catch((err) => console.log(err))
733
- .finally(() => {
734
- // wx.hideLoading()
735
- })
736
- },
737
- // 商品的套餐信息
738
- initGoodsPackage() {
739
- wx.showLoading({
740
- mask: true,
741
- title: '加载中'
742
- })
743
- let params = {
744
- spu_id: this.data.baseInfoQuery.spu_id,
745
- }
746
- getGoodsPackage(params).then(res => {
747
- let {
748
- code,
749
- data: goodsPackage
750
- } = res.data
751
- if (code === 0) {
752
- this.setData({
753
- hasEntityGoods: goodsPackage.entity_goods_num > 0 ? true : false
754
- })
755
- if (this.data.baseInfoQuery.spu_type != "ENT" && goodsPackage.has_package) {
756
- this.setData({
757
- distributionMode: goodsPackage.package_delivery
758
- })
759
- }
760
- }
761
- }).catch((err) => console.log(err))
762
- .finally(() => {
763
- // wx.hideLoading()
764
- })
765
- },
766
- // 进入页面 初始化自提人信息
767
- initPickerInfo() {
768
- wx.showLoading({
769
- mask: true,
770
- title: '加载中'
771
- })
772
- let {
773
- id,
774
- spu_type,
775
- } = this.data.baseInfoQuery
776
- getPickerInfo({
777
- bizData: {
778
- spu_id: id,
779
- spu_type
780
- }
781
- }).then(res => {
782
- if (res.data.code === 0) {
783
- this.setData({
784
- pickerUserInfo: res.data.data || {}
785
- })
786
- if(res.data.data?.lastSelfPickInfo){
787
- this.setData({
788
- picksiteInfo: res.data.data.lastSelfPickInfo.place_name ? res.data.data.lastSelfPickInfo : {}
789
- })
790
- }
791
- }
792
- }).catch((err) => console.log(err))
793
- .finally(() => {
794
- // wx.hideLoading()
795
- })
796
- },
797
- // 初始化订单页基本信息
798
- initConfirmOrderInfo() {
799
- let {
800
- id,
801
- resource_type,
802
- spu_type,
803
- sku
804
- } = this.data.baseInfoQuery
805
- let params = {
806
- spu_id: id,
807
- resource_type,
808
- spu_type,
809
- address_id: this.data.addressInfo.id || "",
810
- sku_id: sku || "",
811
- }
812
- wx.showLoading({
813
- mask: true,
814
- title: '加载中'
815
- })
816
- return getConfirmOrderDetail(params)
817
- },
818
- // 处理初始化订单页基本信息
819
- handleOrderInfo(val) {
820
- let res = val.data
821
- if (res.code === 0) {
822
- this.setData({
823
- confirmOrderInfo: res.data,
824
- resource_id: res.data.goods_info.resource_id,
825
- })
826
- if (this.data.baseInfoQuery.spu_type === "ENT") {
827
- this.setData({
828
- distributionMode: res.data.goods_info.distribution_pattern
829
- })
830
- }
831
- if(this.data.baseInfoQuery.spu_type == "COP"){
832
- this.setData({
833
- distributionMode: res.data.goods_info.sku_info.distribution_pattern
834
- })
835
- }
836
- if (!this.data.isCart) {
837
- let addressInfo = res.data.address_info;
838
- this.setData({
839
- addressInfo: Array.isArray(addressInfo) || !addressInfo ? {} : addressInfo
840
- })
841
- }
842
- if (JSON.stringify(this.data.addressInfo) != "{}") {
843
- this.payInfoChange({
844
- name: 'address',
845
- prePayParams: {
846
- address_id: this.data.addressInfo && this.data.addressInfo.id,
847
- }
848
- });
849
- }
850
- }
851
- },
852
- // 获取商家自提状态
853
- initDeliveryState() {
854
- wx.showLoading({
855
- mask: true,
856
- title: '加载中'
857
- })
858
- getExpressSwitch().then(res => {
859
- if (res.data.code === 0) {
860
- this.setData({
861
- userCanPick: res.data.data.self_service_switch
862
- })
863
- }
864
- })
865
- .catch((err) => console.log(err))
866
- .finally(() => {
867
- // wx.hideLoading()
868
- })
869
- },
870
- // 切换配送模式
871
- changeMode(e) {
872
- let val = e.detail;
873
- let num = 0;
874
- val ? num = 2 : num = 1;
875
- this.setData({
876
- activeMode: val,
877
- express_type: num
878
- })
879
- },
880
- // 支付成功
881
- successCallback(payResult) {
882
- console.log("支付成功2");
883
- this.triggerEvent("successCallback", payResult.detail);
884
- },
885
- // 支付失败
886
- failCallback() {
887
- console.log("支付失败2");
888
- this.triggerEvent("failCallback");
889
- },
890
- }
1
+ // src/ConfirmOrder/components/ConfirmOrderContent/index.js
2
+ import {
3
+ getConfirmOrderDetail,
4
+ getExpressSwitch,
5
+ getPickerInfo,
6
+ getGoodsPackage,
7
+ getSuperVipInfo,
8
+ getBusinessFeature,
9
+ getMarketingInfo,
10
+ getPrePayInfoV3,
11
+ getShopConf
12
+ } from "../../../common/api/confirmOrder"
13
+ import {
14
+ isEmptyObject
15
+ } from "../../../common/utils/index"
16
+ import {
17
+ postCouponList
18
+ } from "../../../common/utils/postCouponList"
19
+ import {
20
+ MEMBER,
21
+ SPECIAL_COLUMN,
22
+ BIG_SPECIAL_COLUMN,
23
+ TRAINING_CAMP,
24
+ SVIP
25
+ } from "../../../common/utils/constants.js";
26
+ import {
27
+ debounce
28
+ } from "../../../common/utils/tool.js"
29
+ const computedBehavior = require('miniprogram-computed').behavior
30
+
31
+ Component({
32
+ behaviors: [computedBehavior],
33
+ /**
34
+ * 组件的属性列表
35
+ */
36
+ properties: {
37
+ baseInfoQuery: {
38
+ type: Object,
39
+ value: () => {},
40
+ },
41
+ isCart: {
42
+ type: Number,
43
+ value: 0,
44
+ },
45
+ isTeam: {
46
+ type: Boolean,
47
+ default: false,
48
+ },
49
+ aliveInfo:{
50
+ type: Object,
51
+ value:{}
52
+ },
53
+ sensorReportParams:{
54
+ type: Object,
55
+ value:{}
56
+ },
57
+ popPosition: {
58
+ type: String,
59
+ value: 'bottom'
60
+ },
61
+ round:{
62
+ type:Boolean,
63
+ value: true
64
+ },
65
+ showClose:{
66
+ type:Boolean,
67
+ value: true
68
+ },
69
+ invoiceSelectZIndex:{
70
+ type: Number,
71
+ value: 100
72
+ },
73
+ invoiceTipZIndex:{
74
+ type: Number,
75
+ value: 100
76
+ },
77
+ zIndex:{
78
+ type: Number,
79
+ value: 100
80
+ },
81
+ },
82
+
83
+ /**
84
+ * 组件的初始数据
85
+ */
86
+ data: {
87
+ activeMode: 0, // 0:快递配送,1:自提
88
+ express_type: 0, // 接口下发配送信息 1-快递配送 2-商品自提
89
+ userCanPick: 1, // 商家是否支持自提 1支持 0不支持
90
+ shopConf: {},
91
+ confirmOrderInfo: {
92
+ // 订单页详细信息(通过查询接口拿到)
93
+ app_info: {},
94
+ goods_info: {},
95
+ },
96
+ distributionMode: 0, // 配送方式 -1全部 1快递配送 2商品自提 (目前只支持实物商品,非实物商品返回0)
97
+ resource_id: "",
98
+ addressInfo: {}, // 地址信息(非自提)
99
+ pickerUserInfo: {}, // 自提人信息
100
+ picksiteInfo:{}, //自提点信息
101
+ hasEntityGoods: false, // 商品套餐是否包含实物商品
102
+ superVipInfo: {}, // 超级会员信息
103
+ businessConf: {},
104
+ marketingData: {}, //营销数据
105
+ isShowPoint: false, // 是否显示选择提货点组件
106
+ isShowSelectShipper: false, // 是否显示选择提货人组件
107
+ isShowCreateShipper: false, // 是否显示新增、编辑提货人组件
108
+ isShowAddressManage: false, // 是否显示地址管理组件(非自提)
109
+ isShowEditAddress: false, // 是否显示新建、编辑组件(非自提)
110
+ addressQuery: {}, // 地址相关组件需要的入参
111
+ marketingDataLoaded: false, //营销数据加载
112
+ cartInfoLoaded: false, //购物车数据加载
113
+ addressInfoLoaded: false, //地址信息加载
114
+ backType: 0, // 弹框顶部返回按钮操作
115
+ backPage: 1, // 1:确认订单页面大组件
116
+ shipperType: 1, // 1:新建自提人;2:编辑自提人
117
+ checkList: {}, // 支付前校验信息
118
+ beforePay: {}, // 支付前校验函数
119
+ afterPay: {}, // 支付后的参数
120
+ afterPayCallback: {}, // 支付后回调
121
+ payParams: {},
122
+ prePayParams: {}, //批价信息参数
123
+ getPrePayInfoReset: null, // 批价防抖函数回调
124
+ //错误信息
125
+ errMsg: {
126
+ 10309: "该商品已售罄",
127
+ 30201: "商家未设置支付方式,请联系商家处理",
128
+ 30202: "支付失败,请联系商家处理",
129
+ 10029: "已拥有,不可重复购买",
130
+ 10067: "该商品已下架,不支持继续购买!",
131
+ 10100: "该商品可能已下架或价格变更,请稍后再试。",
132
+ 10306: "拼团失败,请刷新重试。",
133
+ 10308: "活动即将开始",
134
+ 10310: "商家正努力补货中",
135
+ 10312: "未预约该活动",
136
+ 20012: "购买数量超过活动限制。",
137
+ 20020: "该团已满,请重新下单。",
138
+ 20021: "该活动已结束。",
139
+ 20011: "您已参与本团,不可重复参与。",
140
+ 20077: "配送区域已更新,此收货地址超出配送范围,请重新选择",
141
+ 20023: "单笔订单最多可购买1000件",
142
+ },
143
+ },
144
+
145
+ options: {
146
+ addGlobalClass: true
147
+ },
148
+
149
+ lifetimes: {
150
+ attached: async function () {
151
+ // 在组件实例进入页面节点树时执行
152
+ // 初始化数据
153
+ this.initData();
154
+ if (this.data.baseInfoQuery?.isCollectCoupons) {
155
+ const {
156
+ resource_id,
157
+ resource_type,
158
+ spu_id
159
+ } = this.data.baseInfoQuery
160
+ await postCouponList(spu_id || resource_id, resource_type).then(() => {
161
+ wx.showToast({
162
+ title: '您已享有最佳优惠,下单更优惠~',
163
+ icon: 'none',
164
+ duration: 2000
165
+ })
166
+ }).catch((err) => {
167
+ console.log("优惠券获取列表报错或者没有可领券", err)
168
+ })
169
+ }
170
+ },
171
+ },
172
+ computed: {
173
+ // 是否全屏
174
+ isFullScreen(properties) {
175
+ return properties.popPosition === 'right'
176
+ },
177
+ isShowMain(data) {
178
+ return (
179
+ !data.isShowPoint &&
180
+ !data.isShowSelectShipper &&
181
+ !data.isShowCreateShipper &&
182
+ !data.isShowAddressManage &&
183
+ !data.isShowEditAddress
184
+ )
185
+ },
186
+ //判断模式选择tab栏的显示和隐藏
187
+ showModeSelect(data) {
188
+ return data.distributionMode === -1 && data.userCanPick === 1;
189
+ },
190
+ // 显示地址栏的情况 商品有两种配送方式,商家关闭自提/购物车
191
+ showAddressSelect(data) {
192
+ return (
193
+ data.activeMode === 0 &&
194
+ (data.distributionMode === -1 || data.distributionMode === 1)
195
+ );
196
+ },
197
+ // 商品信息
198
+ goodsInfo(data) {
199
+ if (isEmptyObject(data.confirmOrderInfo.goods_info)) {
200
+ return data.baseInfoQuery;
201
+ }
202
+ return data.confirmOrderInfo.goods_info;
203
+ },
204
+ //通过商家是否开启自提和自提选择 决定自提组件的显示和隐藏
205
+ showPickSelf(data) {
206
+ return (
207
+ data.userCanPick === 1 &&
208
+ (data.activeMode === 1 || data.distributionMode === 2)
209
+ );
210
+ },
211
+ // 公共批价请求参数
212
+ commonPrePayParams(data) {
213
+ let spuType = data.baseInfoQuery.spu_type;
214
+ let coursePackage = [
215
+ MEMBER,
216
+ SPECIAL_COLUMN,
217
+ BIG_SPECIAL_COLUMN,
218
+ TRAINING_CAMP,
219
+ ];
220
+ let paymentType15 = [SVIP]
221
+ let paymentType = 2;
222
+ if (coursePackage.includes(spuType)) {
223
+ paymentType = 3;
224
+ }
225
+ if (paymentType15.includes(spuType)) {
226
+ paymentType = 15;
227
+ }
228
+ return {
229
+ pre_pay_type: data.baseInfoQuery.pre_pay_type || 1,
230
+ resource_id: data.baseInfoQuery.resource_id,
231
+ spu_id: data.baseInfoQuery.id,
232
+ count: data.baseInfoQuery.count,
233
+ // product_id: data.baseInfoQuery.id,
234
+ product_id: '',
235
+ resource_type: data.baseInfoQuery.resource_type,
236
+ spu_type: spuType,
237
+ payment_type: paymentType,
238
+ sku_id: data.baseInfoQuery.sku,
239
+ };
240
+ },
241
+ // 通过请求获取的批价参数是否都已加载完毕
242
+ prePayParamsInfoLoaded(data) {
243
+ return (
244
+ ((data.marketingDataLoaded && !data.isCart) ||
245
+ (data.isCart && data.cartInfoLoaded)) &&
246
+ (data.addressInfoLoaded ||
247
+ Object.keys(data.pickerUserInfo).length > 0 ||
248
+ data.activeMode === 0)
249
+ //加入商品自提后,这里判断是否加载完自提人消息来确定批价参数是否加载完毕
250
+ //每次切换提货模式时也要触发商品批价信息
251
+ );
252
+ },
253
+ },
254
+ observers: {
255
+ distributionMode(val) {
256
+ if (val === 1) {
257
+ this.setData({
258
+ express_type: val
259
+ })
260
+ } else if (val === 2) {
261
+ this.setData({
262
+ express_type: val
263
+ })
264
+ }else if (val === 0) {
265
+ this.setData({
266
+ express_type: val
267
+ })
268
+ }else if (val === -1) {
269
+ this.setData({
270
+ express_type: 1
271
+ })
272
+ }
273
+ },
274
+ marketingData(marketingData) {
275
+ // 这里的逻辑应该是存在拼团的时候那么payment_type就要赋值为13,如果是限时折扣或者是单买的话,payment_type不做赋值默认为2
276
+ if (
277
+ marketingData &&
278
+ marketingData.payment_type &&
279
+ this.data.isTeam === "true"
280
+ ) {
281
+ this.payInfoChange({
282
+ name: "marketingData",
283
+ prePayParams: {
284
+ payment_type: marketingData.payment_type,
285
+ },
286
+ });
287
+ }
288
+ this.setData({
289
+ marketingDataLoaded: true
290
+ })
291
+ },
292
+ isShowCreateShipper(val) {
293
+ if (val) {
294
+ if (this.data.shipperType === 1) {
295
+ this.triggerEvent("changeSheetInfo", {
296
+ title: "新建提货人",
297
+ })
298
+ } else {
299
+ this.triggerEvent("changeSheetInfo", {
300
+ title: "编辑提货人",
301
+ })
302
+ }
303
+ this.triggerEvent("changeSheetInfo", {
304
+ showClose: false,
305
+ showBack: true,
306
+ })
307
+ this.setData({
308
+ backType: 3
309
+ })
310
+ } else {
311
+ this.backClick();
312
+ }
313
+ },
314
+ showPickSelf(val) {
315
+ if (!val) {
316
+ this.payInfoChange({
317
+ name: "pickerUserInfo",
318
+ errMsg: "",
319
+ });
320
+ this.payInfoChange({
321
+ name: "address",
322
+ errMsg: "",
323
+ });
324
+ }
325
+ },
326
+ isShowSelectShipper: function (newData) {
327
+ if (newData) {
328
+ this.triggerEvent("changeSheetInfo", {
329
+ title: "选择提货人",
330
+ showClose: false,
331
+ showBack: true,
332
+ })
333
+ this.setData({
334
+ backType: 2
335
+ })
336
+ } else {
337
+ this.backClick();
338
+ }
339
+ },
340
+ isShowAddressManage(newData) {
341
+ if (newData) {
342
+ this.triggerEvent("changeSheetInfo", {
343
+ title: "选择地址",
344
+ showClose: false,
345
+ showBack: true,
346
+ })
347
+ this.setData({
348
+ backType: 4
349
+ })
350
+ } else {
351
+ if (!this.data.isShowEditAddress) {
352
+ this.backClick()
353
+ }
354
+ }
355
+ },
356
+ isShowEditAddress(newData) {
357
+ if (newData) {
358
+ this.triggerEvent("changeSheetInfo", {
359
+ title: "地址编辑",
360
+ showClose: false,
361
+ showBack: true,
362
+ })
363
+ this.setData({
364
+ backType: 5
365
+ })
366
+ } else {
367
+ this.backClick()
368
+ }
369
+ },
370
+ isShowPoint: function (newData) {
371
+ if (newData) {
372
+ this.triggerEvent("changeSheetInfo", {
373
+ title: "提货地址",
374
+ showClose: false,
375
+ showBack: true,
376
+ })
377
+ this.setData({
378
+ backType: 1
379
+ })
380
+ } else {
381
+ this.backClick();
382
+ }
383
+ },
384
+ prePayParamsInfoLoaded(val) {
385
+ if (val) {
386
+ let obj = {
387
+ ...this.data.commonPrePayParams,
388
+ ...this.data.prePayParams,
389
+ }
390
+ this.setData({
391
+ getPrePayInfoReset: this.getPrePayInfo(obj)
392
+ })
393
+ }
394
+ },
395
+ },
396
+ /**
397
+ * 组件的方法列表
398
+ */
399
+ methods: {
400
+ // 初始化店铺设置信息
401
+ initShopConf() {
402
+ getShopConf().then(res => {
403
+ if (res.data.code === 0) {
404
+ this.setData({
405
+ shopConf: res.data.data
406
+ })
407
+ }
408
+ })
409
+ },
410
+ // 做防抖处理,避免短时间触发多次批价
411
+ getPrePayInfo: debounce(function (payload) {
412
+ // console.log("val: ", val);
413
+ // let payload = val[0]
414
+ if (!payload["resource_id"]) {
415
+ payload = {
416
+ ...payload,
417
+ resource_id: this.data.resource_id,
418
+ };
419
+ }
420
+ this.setData({
421
+ prePayParams: payload
422
+ })
423
+ wx.showLoading({
424
+ mask: true,
425
+ title: '加载中'
426
+ })
427
+ return getPrePayInfoV3(payload).then(res => {
428
+ wx.hideLoading()
429
+ if (res.data.code === 0) {
430
+ this.setData({
431
+ prePayInfo: res.data.data
432
+ })
433
+ } else {
434
+ this.handlePreErrorCode(res.data);
435
+ }
436
+ if (wx.getStorageSync('toastWarn')) {
437
+ wx.showToast({
438
+ title: "单笔订单最多可购买1000件",
439
+ icon: 'none',
440
+ duration: 2000
441
+ })
442
+ setTimeout(() => {
443
+ wx.removeStorage({
444
+ key: "toastWarn"
445
+ })
446
+ }, 3000)
447
+ }
448
+ if (res.data.code === 10310 || res.data.code === 10309) {
449
+ this.setData({
450
+ ["checkList.order"]: "商家努力补货中"
451
+ })
452
+ } else {
453
+ this.setData({
454
+ ["checkList.order"]: ""
455
+ })
456
+ }
457
+ }).catch((err) => console.log(err))
458
+ }, 1000),
459
+ handlePreErrorCode(res) {
460
+ if (res.code !== 20077) {
461
+ this.handleErrorCode(res);
462
+ }
463
+ },
464
+ handleErrorCode(res) {
465
+ // 重复支付错误code特殊逻辑,不做toast处理,弹窗处理
466
+ if (res.code === 20022) {
467
+ return;
468
+ }
469
+
470
+ if (res.code === 10061001) {
471
+ wx.showToast({
472
+ title: "订单信息有变化, 请刷新后重试",
473
+ icon: 'none',
474
+ duration: 2000
475
+ })
476
+ setTimeout(() => {
477
+ this.onLoad()
478
+ }, 1000);
479
+ return;
480
+ }
481
+ wx.showToast({
482
+ title: this.data.errMsg[res.code] || res.msg,
483
+ icon: 'none',
484
+ duration: 2000
485
+ })
486
+ },
487
+ /**
488
+ * @description: 支付参数改变事件,用于约束各业务测支付参数传参
489
+ * @param {string} data.name 业务侧名称,用于区分各业务侧参数
490
+ * @param {string} data.errMsg [同步校验]业务侧参数提示信息,用于支付前判断,目前主要用于判空提示(若为disabled标明只禁止提交,不弹提示。如信息采集,必须等信息采集加载完才能进行提交)
491
+ * @param {promise} data.beforePay [异步校验]业务侧用于进行支付前校验的校验方法, 这里为一个function,并返回一个Promise,resolve返回校验成功true或者校验失败false
492
+ * @param {object} data.prePayParams 业务侧涉及的批价参数,当有此参数时,会触发重新批价
493
+ * @param {object} data.payParams 业务侧涉及的支付参数,用于支付时传参
494
+ * @param {object} data.afterPay 业务侧支付后使用的一些参数 callBack: 支付完成后回调,支付完成后就只执行此回调方法,回调可返回支付完成后的跳转页面;
495
+ * srcUrl:支付失败跳转页面;backUrl: 支付成功跳转页面
496
+ * @param {Boolean} data.triggerPrePay 本次修改是否触发批价
497
+ */
498
+ payInfoChange(val) {
499
+ let data = {};
500
+ val.detail ? data = val.detail : data = val
501
+ this.setData({
502
+ [`checkList.${data.name}`]: data.errMsg || ""
503
+ })
504
+ if (data.beforePay) {
505
+ this.setData({
506
+ [`beforePay.${data.name}`]: data.beforePay
507
+ })
508
+ }
509
+ if (data.afterPay) {
510
+ let {
511
+ callBack,
512
+ ...others
513
+ } = data.afterPay;
514
+ this.setData({
515
+ afterPay: {
516
+ ...this.data.afterPay,
517
+ ...others,
518
+ }
519
+ })
520
+ if (callBack) {
521
+ this.setData({
522
+ [`afterPayCallback.${data.name}`]: callBack
523
+ })
524
+ }
525
+ }
526
+ // 支付参数处理
527
+ if (data.payParams) {
528
+ this.setData({
529
+ payParams: {
530
+ ...this.data.payParams,
531
+ ...data.payParams,
532
+ }
533
+ })
534
+ }
535
+ if (data.prePayParams) {
536
+ // 更新业务批价参数
537
+ this.setData({
538
+ prePayParams: {
539
+ ...this.data.prePayParams,
540
+ ...data.prePayParams,
541
+ }
542
+ })
543
+ if (this.data.prePayParamsInfoLoaded && data.triggerPrePay !== false) {
544
+ let obj = {
545
+ ...this.data.commonPrePayParams,
546
+ ...this.data.prePayParams,
547
+ }
548
+ this.setData({
549
+ getPrePayInfoReset: this.getPrePayInfo(obj)
550
+ })
551
+ }
552
+ }
553
+ },
554
+ // 返回箭头点击事件
555
+ backClick() {
556
+ switch (this.data.backType) {
557
+ case 1:
558
+ this.triggerEvent("changeSheetInfo", {
559
+ title: "确认订单",
560
+ showClose: true,
561
+ showBack: false,
562
+ })
563
+ this.setData({
564
+ isShowPoint: false,
565
+ backType: 0
566
+ })
567
+ break;
568
+ case 2:
569
+ this.triggerEvent("changeSheetInfo", {
570
+ title: "确认订单",
571
+ showClose: true,
572
+ showBack: false,
573
+ })
574
+ this.setData({
575
+ isShowSelectShipper: false,
576
+ backType: 0
577
+ })
578
+ break;
579
+ case 3:
580
+ if (this.data.backPage === 1) {
581
+ this.triggerEvent("changeSheetInfo", {
582
+ title: "确认订单",
583
+ showBack: false,
584
+ });
585
+ } else {
586
+ this.setData({
587
+ isShowSelectShipper: true,
588
+ })
589
+ this.triggerEvent("changeSheetInfo", {
590
+ title: "选择提货人",
591
+ showBack: true,
592
+ });
593
+ }
594
+ this.triggerEvent("changeSheetInfo", {
595
+ showClose: true,
596
+ });
597
+ this.setData({
598
+ isShowCreateShipper: false,
599
+ backType: 0
600
+ })
601
+ break;
602
+ case 4:
603
+ this.setData({
604
+ isShowAddressManage: false,
605
+ backType: 0
606
+ })
607
+ this.triggerEvent("changeSheetInfo", {
608
+ title: "确认订单",
609
+ showClose: true,
610
+ showBack: false,
611
+ })
612
+ break;
613
+ case 5:
614
+ this.setData({
615
+ isShowEditAddress: false,
616
+ backType: 0
617
+ })
618
+ this.triggerEvent("changeSheetInfo", {
619
+ title: "确认订单",
620
+ showClose: true,
621
+ showBack: false,
622
+ })
623
+ break;
624
+ }
625
+ },
626
+ // 供子组件修改父组件值
627
+ updataData(e) {
628
+ this.setData({
629
+ ...e.detail
630
+ })
631
+ },
632
+ async handleInfo() {
633
+ let result = await this.initConfirmOrderInfo();
634
+ this.handleOrderInfo(result);
635
+ wx.hideLoading()
636
+ },
637
+ // 初始化数据,请求相应接口
638
+ async initData() {
639
+ if (!this.data.shopConf || isEmptyObject(this.data.shopConf)) {
640
+ // 页面刷新重新初始化店铺设置信息
641
+ this.initShopConf();
642
+ }
643
+ let result = await this.initConfirmOrderInfo();
644
+ this.handleOrderInfo(result);
645
+ this.initDeliveryState();
646
+ this.initPickerInfo();
647
+ this.initGoodsPackage();
648
+ this.initSuperVipInfo();
649
+ this.initBusinessFeatureConf();
650
+ if (!this.data.isCart) {
651
+ this.initMarketingData();
652
+ }
653
+ },
654
+ // 获取营销活动信息
655
+ initMarketingData() {
656
+ wx.showLoading({
657
+ mask: true,
658
+ title: '加载中'
659
+ })
660
+ let params = {
661
+ spu_id: this.data.baseInfoQuery.id,
662
+ spu_type: this.data.baseInfoQuery.spu_type,
663
+ resource_type: this.data.baseInfoQuery.resource_type,
664
+ }
665
+ getMarketingInfo(params).then(val => {
666
+ let res = val.data;
667
+ if (res.code === 0) {
668
+ let marketing_info = res.data.marketing_info;
669
+ if (
670
+ marketing_info?.activity_type === 3 &&
671
+ !(
672
+ (marketing_info?.all_stock > 0 &&
673
+ marketing_info?.now_stock > 0) ||
674
+ marketing_info?.all_stock == 0
675
+ ) &&
676
+ ![21, 29, 41, 42].includes(marketing_info.resource_type)
677
+ ) {
678
+ // 这里的逻辑要注意,如果接口返回了营销信息但工程拿不到的话,问题就在这里。
679
+ // 如果是限时折扣,且达到了限量后,就应该不显示限时折扣的信息了,我选择在源头就断了这个数据,但保留了推广员的信息
680
+ // 且这里不能是多规格的商品,因为多规格的商品没有限量的设置,如果你看到的时候已经准备有了,麻烦跟产品说这需求咱不接,咱不受这鸟气
681
+ res.data.marketing_info = null;
682
+ }
683
+ this.setData({
684
+ marketingData: res.data
685
+ })
686
+ } else {
687
+ this.setData({
688
+ marketingDataLoaded: true
689
+ })
690
+ }
691
+ }).catch((err) => console.log(err))
692
+ .finally(() => {
693
+ // // wx.hideLoading()
694
+ })
695
+ },
696
+ // 业务特性信息
697
+ initBusinessFeatureConf() {
698
+ wx.showLoading({
699
+ mask: true,
700
+ title: '加载中'
701
+ })
702
+ let params = {
703
+ spu_id: this.data.baseInfoQuery.id
704
+ }
705
+ getBusinessFeature(params).then(res => {
706
+ if (res.data.code === 0) {
707
+ this.setData({
708
+ businessConf: res.data.data
709
+ })
710
+ }
711
+ }).catch((err) => console.log(err))
712
+ .finally(() => {
713
+ // wx.hideLoading()
714
+ })
715
+ },
716
+ // 获取超级会员相关信息
717
+ initSuperVipInfo() {
718
+ wx.showLoading({
719
+ mask: true,
720
+ title: '加载中'
721
+ })
722
+ let params = {
723
+ resource_id: this.data.baseInfoQuery.resource_id || this.data.resource_id,
724
+ resource_type: this.data.baseInfoQuery.resource_type,
725
+ };
726
+ getSuperVipInfo(params).then(res => {
727
+ if (res.data.code === 0) {
728
+ this.setData({
729
+ superVipInfo: res.data.data
730
+ })
731
+ }
732
+ }).catch((err) => console.log(err))
733
+ .finally(() => {
734
+ // wx.hideLoading()
735
+ })
736
+ },
737
+ // 商品的套餐信息
738
+ initGoodsPackage() {
739
+ wx.showLoading({
740
+ mask: true,
741
+ title: '加载中'
742
+ })
743
+ let params = {
744
+ spu_id: this.data.baseInfoQuery.spu_id,
745
+ }
746
+ getGoodsPackage(params).then(res => {
747
+ let {
748
+ code,
749
+ data: goodsPackage
750
+ } = res.data
751
+ if (code === 0) {
752
+ this.setData({
753
+ hasEntityGoods: goodsPackage.entity_goods_num > 0 ? true : false
754
+ })
755
+ if (this.data.baseInfoQuery.spu_type != "ENT" && goodsPackage.has_package) {
756
+ this.setData({
757
+ distributionMode: goodsPackage.package_delivery
758
+ })
759
+ }
760
+ }
761
+ }).catch((err) => console.log(err))
762
+ .finally(() => {
763
+ // wx.hideLoading()
764
+ })
765
+ },
766
+ // 进入页面 初始化自提人信息
767
+ initPickerInfo() {
768
+ wx.showLoading({
769
+ mask: true,
770
+ title: '加载中'
771
+ })
772
+ let {
773
+ id,
774
+ spu_type,
775
+ } = this.data.baseInfoQuery
776
+ getPickerInfo({
777
+ bizData: {
778
+ spu_id: id,
779
+ spu_type
780
+ }
781
+ }).then(res => {
782
+ if (res.data.code === 0) {
783
+ this.setData({
784
+ pickerUserInfo: res.data.data || {}
785
+ })
786
+ if(res.data.data?.lastSelfPickInfo){
787
+ this.setData({
788
+ picksiteInfo: res.data.data.lastSelfPickInfo.place_name ? res.data.data.lastSelfPickInfo : {}
789
+ })
790
+ }
791
+ }
792
+ }).catch((err) => console.log(err))
793
+ .finally(() => {
794
+ // wx.hideLoading()
795
+ })
796
+ },
797
+ // 初始化订单页基本信息
798
+ initConfirmOrderInfo() {
799
+ let {
800
+ id,
801
+ resource_type,
802
+ spu_type,
803
+ sku
804
+ } = this.data.baseInfoQuery
805
+ let params = {
806
+ spu_id: id,
807
+ resource_type,
808
+ spu_type,
809
+ address_id: this.data.addressInfo.id || "",
810
+ sku_id: sku || "",
811
+ }
812
+ wx.showLoading({
813
+ mask: true,
814
+ title: '加载中'
815
+ })
816
+ return getConfirmOrderDetail(params)
817
+ },
818
+ // 处理初始化订单页基本信息
819
+ handleOrderInfo(val) {
820
+ let res = val.data
821
+ if (res.code === 0) {
822
+ this.setData({
823
+ confirmOrderInfo: res.data,
824
+ resource_id: res.data.goods_info.resource_id,
825
+ })
826
+ if (this.data.baseInfoQuery.spu_type === "ENT") {
827
+ this.setData({
828
+ distributionMode: res.data.goods_info.distribution_pattern
829
+ })
830
+ }
831
+ if(this.data.baseInfoQuery.spu_type == "COP"){
832
+ this.setData({
833
+ distributionMode: res.data.goods_info.sku_info.distribution_pattern
834
+ })
835
+ }
836
+ if (!this.data.isCart) {
837
+ let addressInfo = res.data.address_info;
838
+ this.setData({
839
+ addressInfo: Array.isArray(addressInfo) || !addressInfo ? {} : addressInfo
840
+ })
841
+ }
842
+ if (JSON.stringify(this.data.addressInfo) != "{}") {
843
+ this.payInfoChange({
844
+ name: 'address',
845
+ prePayParams: {
846
+ address_id: this.data.addressInfo && this.data.addressInfo.id,
847
+ }
848
+ });
849
+ }
850
+ }
851
+ },
852
+ // 获取商家自提状态
853
+ initDeliveryState() {
854
+ wx.showLoading({
855
+ mask: true,
856
+ title: '加载中'
857
+ })
858
+ getExpressSwitch().then(res => {
859
+ if (res.data.code === 0) {
860
+ this.setData({
861
+ userCanPick: res.data.data.self_service_switch
862
+ })
863
+ }
864
+ })
865
+ .catch((err) => console.log(err))
866
+ .finally(() => {
867
+ // wx.hideLoading()
868
+ })
869
+ },
870
+ // 切换配送模式
871
+ changeMode(e) {
872
+ let val = e.detail;
873
+ let num = 0;
874
+ val ? num = 2 : num = 1;
875
+ this.setData({
876
+ activeMode: val,
877
+ express_type: num
878
+ })
879
+ },
880
+ // 支付成功
881
+ successCallback(payResult) {
882
+ console.log("支付成功2");
883
+ this.triggerEvent("successCallback", payResult.detail);
884
+ },
885
+ // 支付失败
886
+ failCallback() {
887
+ console.log("支付失败2");
888
+ this.triggerEvent("failCallback");
889
+ },
890
+ }
891
891
  })