vhall-mini-sdk 0.1.0 → 0.1.1

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 (261) hide show
  1. package/lib/components/player/components/online-hot/index.js +2 -2
  2. package/lib/sdk/main/index.js +1 -0
  3. package/package.json +2 -4
  4. package/postinstall.js +21 -51
  5. package/dist/components/chat/chat-edit/chat-edit.js +0 -127
  6. package/dist/components/chat/chat-edit/chat-edit.json +0 -4
  7. package/dist/components/chat/chat-edit/chat-edit.wxml +0 -7
  8. package/dist/components/chat/chat-edit/chat-edit.wxss +0 -1
  9. package/dist/components/chat/chat-item/chat-item.js +0 -253
  10. package/dist/components/chat/chat-item/chat-item.json +0 -3
  11. package/dist/components/chat/chat-item/chat-item.wxml +0 -96
  12. package/dist/components/chat/chat-item/chat-item.wxss +0 -1
  13. package/dist/components/chat/chat-list/chat-list.js +0 -216
  14. package/dist/components/chat/chat-list/chat-list.json +0 -6
  15. package/dist/components/chat/chat-list/chat-list.wxml +0 -9
  16. package/dist/components/chat/chat-list/chat-list.wxss +0 -1
  17. package/dist/components/chat/chat.js +0 -98
  18. package/dist/components/chat/chat.json +0 -7
  19. package/dist/components/chat/chat.wxml +0 -7
  20. package/dist/components/chat/chat.wxss +0 -1
  21. package/dist/components/gift/gift-display/gift-display.js +0 -118
  22. package/dist/components/gift/gift-display/gift-display.json +0 -3
  23. package/dist/components/gift/gift-display/gift-display.wxml +0 -16
  24. package/dist/components/gift/gift-display/gift-display.wxss +0 -1
  25. package/dist/components/gift/gift-sender/gift-sender.js +0 -63
  26. package/dist/components/gift/gift-sender/gift-sender.json +0 -6
  27. package/dist/components/gift/gift-sender/gift-sender.wxml +0 -19
  28. package/dist/components/gift/gift-sender/gift-sender.wxss +0 -1
  29. package/dist/components/introduction/introduction.js +0 -43
  30. package/dist/components/introduction/introduction.json +0 -3
  31. package/dist/components/introduction/introduction.wxml +0 -8
  32. package/dist/components/introduction/introduction.wxss +0 -1
  33. package/dist/components/invite-rank/img/bronze.png +0 -0
  34. package/dist/components/invite-rank/img/gold.png +0 -0
  35. package/dist/components/invite-rank/img/silver.png +0 -0
  36. package/dist/components/invite-rank/index.js +0 -135
  37. package/dist/components/invite-rank/index.json +0 -8
  38. package/dist/components/invite-rank/index.wxml +0 -42
  39. package/dist/components/invite-rank/index.wxss +0 -1
  40. package/dist/components/invite-rank/invite-rank-item.js +0 -12
  41. package/dist/components/invite-rank/invite-rank-item.json +0 -4
  42. package/dist/components/invite-rank/invite-rank-item.wxml +0 -21
  43. package/dist/components/invite-rank/invite-rank-item.wxss +0 -1
  44. package/dist/components/invite-rank/my-invite-detail.js +0 -82
  45. package/dist/components/invite-rank/my-invite-detail.json +0 -7
  46. package/dist/components/invite-rank/my-invite-detail.wxml +0 -27
  47. package/dist/components/invite-rank/my-invite-detail.wxss +0 -1
  48. package/dist/components/invite-rank/util.wxs +0 -21
  49. package/dist/components/live-landscape/live-landscape.js +0 -216
  50. package/dist/components/live-landscape/live-landscape.json +0 -39
  51. package/dist/components/live-landscape/live-landscape.wxml +0 -73
  52. package/dist/components/live-landscape/live-landscape.wxss +0 -1
  53. package/dist/components/live-portrait/live-portrait.js +0 -274
  54. package/dist/components/live-portrait/live-portrait.json +0 -38
  55. package/dist/components/live-portrait/live-portrait.wxml +0 -106
  56. package/dist/components/live-portrait/live-portrait.wxss +0 -1
  57. package/dist/components/lottery/lottery-accept/index.js +0 -249
  58. package/dist/components/lottery/lottery-accept/index.json +0 -4
  59. package/dist/components/lottery/lottery-accept/index.wxml +0 -49
  60. package/dist/components/lottery/lottery-accept/index.wxss +0 -1
  61. package/dist/components/lottery/lottery-history/index.js +0 -36
  62. package/dist/components/lottery/lottery-history/index.json +0 -3
  63. package/dist/components/lottery/lottery-history/index.wxml +0 -28
  64. package/dist/components/lottery/lottery-history/index.wxss +0 -1
  65. package/dist/components/lottery/lottery-shake/lottery-shake.js +0 -328
  66. package/dist/components/lottery/lottery-shake/lottery-shake.json +0 -1
  67. package/dist/components/lottery/lottery-shake/lottery-shake.wxml +0 -52
  68. package/dist/components/lottery/lottery-shake/lottery-shake.wxss +0 -1
  69. package/dist/components/lottery/lottery-slot/lottery-slot.js +0 -230
  70. package/dist/components/lottery/lottery-slot/lottery-slot.json +0 -1
  71. package/dist/components/lottery/lottery-slot/lottery-slot.wxml +0 -62
  72. package/dist/components/lottery/lottery-slot/lottery-slot.wxss +0 -1
  73. package/dist/components/lottery/lottery-wheel/lottery-wheel.js +0 -153
  74. package/dist/components/lottery/lottery-wheel/lottery-wheel.json +0 -4
  75. package/dist/components/lottery/lottery-wheel/lottery-wheel.wxml +0 -91
  76. package/dist/components/lottery/lottery-wheel/lottery-wheel.wxss +0 -1
  77. package/dist/components/lottery/lottery-winners/index.js +0 -101
  78. package/dist/components/lottery/lottery-winners/index.json +0 -4
  79. package/dist/components/lottery/lottery-winners/index.wxml +0 -39
  80. package/dist/components/lottery/lottery-winners/index.wxss +0 -1
  81. package/dist/components/lottery/lottery.js +0 -388
  82. package/dist/components/lottery/lottery.json +0 -11
  83. package/dist/components/lottery/lottery.wxml +0 -78
  84. package/dist/components/lottery/lottery.wxss +0 -1
  85. package/dist/components/lottery/wheel.json +0 -49
  86. package/dist/components/mall-reward/common/reward-card.wxss +0 -0
  87. package/dist/components/mall-reward/duration-icon/index.js +0 -101
  88. package/dist/components/mall-reward/duration-icon/index.json +0 -3
  89. package/dist/components/mall-reward/duration-icon/index.wxml +0 -7
  90. package/dist/components/mall-reward/duration-icon/index.wxss +0 -1
  91. package/dist/components/mall-reward/f-count-down/index.js +0 -61
  92. package/dist/components/mall-reward/f-count-down/index.json +0 -3
  93. package/dist/components/mall-reward/f-count-down/index.wxml +0 -9
  94. package/dist/components/mall-reward/f-count-down/index.wxss +0 -1
  95. package/dist/components/mall-reward/f-empty/index.js +0 -11
  96. package/dist/components/mall-reward/f-empty/index.json +0 -3
  97. package/dist/components/mall-reward/f-empty/index.wxml +0 -8
  98. package/dist/components/mall-reward/f-empty/index.wxss +0 -1
  99. package/dist/components/mall-reward/f-history/index.js +0 -84
  100. package/dist/components/mall-reward/f-history/index.json +0 -4
  101. package/dist/components/mall-reward/f-history/index.wxml +0 -38
  102. package/dist/components/mall-reward/f-history/index.wxss +0 -1
  103. package/dist/components/mall-reward/f-open/index.js +0 -36
  104. package/dist/components/mall-reward/f-open/index.json +0 -3
  105. package/dist/components/mall-reward/f-open/index.wxml +0 -10
  106. package/dist/components/mall-reward/f-open/index.wxss +0 -1
  107. package/dist/components/mall-reward/f-receive/index.js +0 -36
  108. package/dist/components/mall-reward/f-receive/index.json +0 -3
  109. package/dist/components/mall-reward/f-receive/index.wxml +0 -9
  110. package/dist/components/mall-reward/f-receive/index.wxss +0 -1
  111. package/dist/components/mall-reward/index.js +0 -374
  112. package/dist/components/mall-reward/index.json +0 -8
  113. package/dist/components/mall-reward/index.wxml +0 -4
  114. package/dist/components/mall-reward/index.wxss +0 -0
  115. package/dist/components/mall-reward/main-popup/index.js +0 -46
  116. package/dist/components/mall-reward/main-popup/index.json +0 -12
  117. package/dist/components/mall-reward/main-popup/index.wxml +0 -16
  118. package/dist/components/mall-reward/main-popup/index.wxss +0 -1
  119. package/dist/components/player/assets/image/arrow-left.png +0 -0
  120. package/dist/components/player/assets/image/arrow-right.png +0 -0
  121. package/dist/components/player/assets/image/enterFullScreen.png +0 -0
  122. package/dist/components/player/assets/image/exitFullScreen.png +0 -0
  123. package/dist/components/player/assets/image/fullscreen_1.png +0 -0
  124. package/dist/components/player/assets/image/fullscreen_2.png +0 -0
  125. package/dist/components/player/assets/image/pause.png +0 -0
  126. package/dist/components/player/assets/image/pause_1.png +0 -0
  127. package/dist/components/player/assets/image/play.png +0 -0
  128. package/dist/components/player/assets/image/play_1.png +0 -0
  129. package/dist/components/player/assets/image/refresh.png +0 -0
  130. package/dist/components/player/assets/image/refresh_1.png +0 -0
  131. package/dist/components/player/assets/image/subtitle_close.png +0 -0
  132. package/dist/components/player/assets/image/subtitle_default.png +0 -0
  133. package/dist/components/player/assets/image/volume-off.png +0 -0
  134. package/dist/components/player/assets/image/volume-on.png +0 -0
  135. package/dist/components/player/common/config.js +0 -7
  136. package/dist/components/player/common/veComponent.js +0 -4
  137. package/dist/components/player/components/barrage/barrage-canvas.js +0 -488
  138. package/dist/components/player/components/barrage/barrage-dom.js +0 -471
  139. package/dist/components/player/components/barrage/index.js +0 -62
  140. package/dist/components/player/components/barrage/index.json +0 -4
  141. package/dist/components/player/components/barrage/index.wxml +0 -39
  142. package/dist/components/player/components/barrage/index.wxss +0 -1
  143. package/dist/components/player/components/barrage/utils.js +0 -71
  144. package/dist/components/player/components/controls/controls.js +0 -93
  145. package/dist/components/player/components/controls/controls.json +0 -6
  146. package/dist/components/player/components/controls/controls.wxml +0 -60
  147. package/dist/components/player/components/controls/controls.wxss +0 -1
  148. package/dist/components/player/components/danmaku/danmaku.js +0 -23
  149. package/dist/components/player/components/danmaku/danmaku.json +0 -4
  150. package/dist/components/player/components/danmaku/danmaku.wxml +0 -1
  151. package/dist/components/player/components/danmaku/danmaku.wxss +0 -0
  152. package/dist/components/player/components/error/error.js +0 -15
  153. package/dist/components/player/components/error/error.json +0 -3
  154. package/dist/components/player/components/error/error.wxml +0 -6
  155. package/dist/components/player/components/error/error.wxss +0 -1
  156. package/dist/components/player/components/loading/loading.js +0 -9
  157. package/dist/components/player/components/loading/loading.json +0 -3
  158. package/dist/components/player/components/loading/loading.wxml +0 -4
  159. package/dist/components/player/components/loading/loading.wxss +0 -1
  160. package/dist/components/player/components/main/extensions/data.js +0 -8
  161. package/dist/components/player/components/main/extensions/export.js +0 -83
  162. package/dist/components/player/components/main/extensions/methods.js +0 -110
  163. package/dist/components/player/components/main/extensions/observers.js +0 -41
  164. package/dist/components/player/components/main/extensions/props.js +0 -177
  165. package/dist/components/player/components/main/index.js +0 -44
  166. package/dist/components/player/components/main/index.json +0 -4
  167. package/dist/components/player/components/main/index.wxml +0 -7
  168. package/dist/components/player/components/main/index.wxss +0 -1
  169. package/dist/components/player/components/marquee/marquee.js +0 -304
  170. package/dist/components/player/components/marquee/marquee.json +0 -4
  171. package/dist/components/player/components/marquee/marquee.wxml +0 -14
  172. package/dist/components/player/components/marquee/marquee.wxss +0 -1
  173. package/dist/components/player/components/online-hot/assets/line-hot.png +0 -0
  174. package/dist/components/player/components/online-hot/assets/line-user.png +0 -0
  175. package/dist/components/player/components/online-hot/index.js +0 -66
  176. package/dist/components/player/components/online-hot/index.json +0 -3
  177. package/dist/components/player/components/online-hot/index.wxml +0 -15
  178. package/dist/components/player/components/online-hot/index.wxss +0 -1
  179. package/dist/components/player/components/poster/poster.js +0 -12
  180. package/dist/components/player/components/poster/poster.json +0 -3
  181. package/dist/components/player/components/poster/poster.wxml +0 -5
  182. package/dist/components/player/components/poster/poster.wxss +0 -1
  183. package/dist/components/player/components/watermark/watermark.js +0 -52
  184. package/dist/components/player/components/watermark/watermark.json +0 -4
  185. package/dist/components/player/components/watermark/watermark.wxml +0 -8
  186. package/dist/components/player/components/watermark/watermark.wxss +0 -1
  187. package/dist/components/player/extensions/data.js +0 -63
  188. package/dist/components/player/extensions/export.js +0 -325
  189. package/dist/components/player/extensions/methods.js +0 -406
  190. package/dist/components/player/extensions/observers.js +0 -114
  191. package/dist/components/player/extensions/props.js +0 -162
  192. package/dist/components/player/player.js +0 -83
  193. package/dist/components/player/player.json +0 -33
  194. package/dist/components/player/player.wxml +0 -48
  195. package/dist/components/player/player.wxss +0 -1
  196. package/dist/components/praise/praise.js +0 -150
  197. package/dist/components/praise/praise.json +0 -5
  198. package/dist/components/praise/praise.wxml +0 -17
  199. package/dist/components/praise/praise.wxss +0 -1
  200. package/dist/components/product/product-card/product-card.js +0 -109
  201. package/dist/components/product/product-card/product-card.json +0 -3
  202. package/dist/components/product/product-card/product-card.wxml +0 -47
  203. package/dist/components/product/product-card/product-card.wxss +0 -1
  204. package/dist/components/product/product-detail/product-detail.js +0 -127
  205. package/dist/components/product/product-detail/product-detail.json +0 -3
  206. package/dist/components/product/product-detail/product-detail.wxml +0 -57
  207. package/dist/components/product/product-detail/product-detail.wxss +0 -1
  208. package/dist/components/product/product-item/product-item.js +0 -56
  209. package/dist/components/product/product-item/product-item.json +0 -3
  210. package/dist/components/product/product-item/product-item.wxml +0 -35
  211. package/dist/components/product/product-item/product-item.wxss +0 -1
  212. package/dist/components/product/product-list/product-list.js +0 -67
  213. package/dist/components/product/product-list/product-list.json +0 -6
  214. package/dist/components/product/product-list/product-list.wxml +0 -16
  215. package/dist/components/product/product-list/product-list.wxss +0 -1
  216. package/dist/components/product/product-order/product-order.js +0 -394
  217. package/dist/components/product/product-order/product-order.json +0 -3
  218. package/dist/components/product/product-order/product-order.wxml +0 -75
  219. package/dist/components/product/product-order/product-order.wxss +0 -1
  220. package/dist/components/signin/signin-dialog.js +0 -305
  221. package/dist/components/signin/signin-dialog.json +0 -7
  222. package/dist/components/signin/signin-dialog.wxml +0 -19
  223. package/dist/components/signin/signin-dialog.wxss +0 -1
  224. package/dist/components/top-notify/index.js +0 -14
  225. package/dist/components/top-notify/index.json +0 -3
  226. package/dist/components/top-notify/index.wxml +0 -2
  227. package/dist/components/top-notify/index.wxss +0 -1
  228. package/dist/pubComponents/countdown/countdown.js +0 -97
  229. package/dist/pubComponents/countdown/countdown.json +0 -5
  230. package/dist/pubComponents/countdown/countdown.wxml +0 -19
  231. package/dist/pubComponents/countdown/countdown.wxss +0 -1
  232. package/dist/pubComponents/error-page/index.js +0 -146
  233. package/dist/pubComponents/error-page/index.json +0 -5
  234. package/dist/pubComponents/error-page/index.wxml +0 -37
  235. package/dist/pubComponents/error-page/index.wxss +0 -1
  236. package/dist/pubComponents/popup/popup.js +0 -161
  237. package/dist/pubComponents/popup/popup.json +0 -5
  238. package/dist/pubComponents/popup/popup.wxml +0 -17
  239. package/dist/pubComponents/popup/popup.wxss +0 -1
  240. package/dist/pubComponents/tabs/index.js +0 -95
  241. package/dist/pubComponents/tabs/index.json +0 -4
  242. package/dist/pubComponents/tabs/index.wxml +0 -22
  243. package/dist/pubComponents/tabs/index.wxss +0 -1
  244. package/dist/sdk/config/index.js +0 -1
  245. package/dist/sdk/main/index.js +0 -1
  246. package/dist/sdk/player/index.js +0 -1
  247. package/dist/sdk/plugins/ChatServer.js +0 -1
  248. package/dist/sdk/plugins/CustomMenuServer.js +0 -1
  249. package/dist/sdk/plugins/InteractServer.js +0 -1
  250. package/dist/sdk/plugins/InviteCardServer.js +0 -1
  251. package/dist/sdk/plugins/LotteryServer.js +0 -1
  252. package/dist/sdk/plugins/MallRewardServer.js +0 -1
  253. package/dist/sdk/plugins/ProductServer.js +0 -1
  254. package/dist/shared/RequestUtil.js +0 -1
  255. package/dist/shared/SerializableMap.js +0 -1
  256. package/dist/shared/base.server.js +0 -1
  257. package/dist/shared/cacheUtil.js +0 -1
  258. package/dist/shared/dateUtil.js +0 -1
  259. package/dist/shared/logger.js +0 -1
  260. package/dist/shared/mpUtils.js +0 -1
  261. package/dist/shared/utils.js +0 -1
@@ -1,57 +0,0 @@
1
- <view wx:if="{{show}}" class="product-detail-container">
2
- <view class="product-detail-content">
3
- <!-- 图片轮播 -->
4
- <view class="product-images">
5
- <view class="close-btn" bindtap="closeDetail">×</view>
6
- <swiper
7
- class="swiper"
8
- current="{{currentImageIndex}}"
9
- bindchange="bindchange"
10
- indicator-dots="false"
11
- autoplay="false"
12
- circular="true"
13
- >
14
- <block wx:for="{{product.images}}" wx:key="{{index}}">
15
- <swiper-item class="swiper-item">
16
- <view class="product-image">
17
- <image class="product-detail-img" src="{{item.img_url}}" mode="aspectFill"></image>
18
- </view>
19
- </swiper-item>
20
- </block>
21
- </swiper>
22
- <view class="image-indicator">
23
- {{currentImageIndex + 1}}/{{product.images ? product.images.length : 1}}
24
- </view>
25
- </view>
26
-
27
- <!-- 商品信息 -->
28
- <view class="product-info">
29
- <!-- 价格 -->
30
- <block wx:if="{{product.covered_status === 1}}">
31
- <text class="covered-price">¥?待开价</text>
32
- </block>
33
- <block wx:else>
34
- <view class="price-container">
35
- <text class="discount-price">¥{{product.discount_price || product.price || 0}}</text>
36
- <text wx:if="{{product.discount_price && product.price && product.discount_price !== product.price}}" class="original-price">¥{{product.price}}</text>
37
- </view>
38
- </block>
39
-
40
- <!-- 商品名称 -->
41
- <text class="product-title">{{product.name || '商品名称'}}</text>
42
-
43
- <!-- 商品描述 -->
44
- <text class="product-desc">{{product.description || ''}}</text>
45
-
46
-
47
-
48
- <!-- 购买按钮 -->
49
- <view
50
- class="buy-btn {{product.sale_status === 0 || product.covered_status === 1 ? 'disabled' : ''}}"
51
- bindtap="buyProduct"
52
- >
53
- {{product.sale_status === 0 ? '已抢光' : product.covered_status === 1 ? '待开价' : '购买'}}
54
- </view>
55
- </view>
56
- </view>
57
- </view>
@@ -1 +0,0 @@
1
- .product-detail-container{align-items:flex-end;background-color:rgba(0,0,0,.5);bottom:0;display:flex;left:0;position:fixed;right:0;top:0;z-index:9999}.product-detail-content{background-color:#fff;border-radius:20rpx 20rpx 0 0;max-height:90vh;overflow:hidden;width:100%}.product-images{background-color:#f5f5f5;height:750rpx;position:relative}.swiper{height:100%}.swiper-item{align-items:center;display:flex;height:100%;justify-content:center}.product-image{height:100%;width:100%}.product-image .product-detail-img{height:100%;object-fit:contain;width:100%}.image-indicator{border-radius:20rpx;bottom:20rpx;font-size:.86rem;padding:8rpx 16rpx}.close-btn,.image-indicator{background-color:rgba(0,0,0,.6);color:#fff;position:absolute;right:20rpx}.close-btn{align-items:center;border-radius:50%;display:flex;font-size:1.29rem;height:60rpx;justify-content:center;top:20rpx;width:60rpx;z-index:10}.product-info{padding:30rpx}.price-container{align-items:baseline;display:flex;margin-bottom:30rpx}.discount-price{color:#fb2626;font-size:1.43rem;margin-right:20rpx}.original-price{color:#999;font-size:1rem;text-decoration:line-through}.product-title{-webkit-line-clamp:2;color:#333;font-size:1.14rem;font-weight:700;line-height:1.71rem;margin-bottom:20rpx}.product-desc,.product-title{-webkit-box-orient:vertical;display:block;display:-webkit-box;overflow:hidden;text-overflow:ellipsis}.product-desc{-webkit-line-clamp:3;color:#666;font-size:1rem;line-height:1.43rem;margin-bottom:30rpx}.covered-price{color:#999;font-size:1.14rem;margin-bottom:30rpx}.buy-btn{align-items:center;background-color:#fb2626;border-radius:45rpx;color:#fff;display:flex;font-size:1.14rem;font-weight:700;height:90rpx;justify-content:center;margin-top:20rpx;width:100%}.buy-btn.disabled{background-color:#ccc;color:#999;cursor:not-allowed}
@@ -1,56 +0,0 @@
1
- import { appendParamsToPath } from '../../../shared/utils.js';
2
- Component({
3
- properties: {
4
- // 商品数据
5
- product: {
6
- type: Object,
7
- value: {}
8
- },
9
- // 商品序号
10
- index: {
11
- type: Number,
12
- value: 0
13
- },
14
- webinarId: {
15
- type: String,
16
- value: 0
17
- }
18
- },
19
- data: {
20
- // 组件内部数据
21
- },
22
- methods: {
23
- // 点击商品
24
- onProductClick() {
25
- this.triggerEvent('openDetail', this.properties.product);
26
- },
27
- // 点击购买按钮
28
- onBuyClick(e) {
29
- const product = this.properties.product;
30
- // 检查是否已抢光或待开价
31
- if (product.sale_status === 0 || product.covered_status === 1) {
32
- return;
33
- }
34
-
35
- // 检查 buy_type
36
- if (product.buy_type === 4 && product?.mini_program_config?.mini_program_path) {
37
- // 跳转到小程序路径
38
- const webinarId = this.properties.webinarId;
39
- console.log("跳转小程序路径:", appendParamsToPath(product?.mini_program_config?.mini_program_path, { webinarId }))
40
- wx.navigateTo({
41
- url: appendParamsToPath(product?.mini_program_config?.mini_program_path, { webinarId })
42
- });
43
- } else if (product.buy_type === 1) {
44
- // 触发购买事件,由父组件显示下单弹窗
45
- this.triggerEvent('buyClick', product);
46
- } else {
47
- // 提示无法购买
48
- wx.showToast({
49
- title: '无法购买,请联系主办方',
50
- icon: 'none',
51
- duration: 2000
52
- });
53
- }
54
- }
55
- }
56
- });
@@ -1,3 +0,0 @@
1
- {
2
- "component": true
3
- }
@@ -1,35 +0,0 @@
1
- <view class="product-item" bindtap="onProductClick">
2
- <view class="product-image">
3
- <view class="product-index">{{index + 1}}</view>
4
- <image src="{{product.cover_img || 'https://cnstatic01.e.vhall.com/common-static/images/default_avatar.png'}}" mode="aspectFill"></image>
5
- <view wx:if="{{product.sale_status === 0}}" class="product-mask">
6
- <text class="product-mask-text">已抢光</text>
7
- </view>
8
- <!-- 讲解中标识 -->
9
- <view wx:if="{{product.push_status === 1}}" class="product-badge">
10
- <image src="https://cnstatic01.e.vhall.com/common-static/saas-wap/static/img/live.b07d13f4.gif" mode="heightFix" style="height: 20rpx; margin-right: 8rpx;"></image>
11
- <text class="product-badge-text">讲解中</text>
12
- </view>
13
- </view>
14
- <view class="product-info">
15
- <view>
16
- <text class="product-name">{{product.name }}</text>
17
- <text class="product-desc">{{product.description }}</text>
18
- </view>
19
- <!-- 价格显示逻辑 -->
20
- <block wx:if="{{product.covered_status === 1}}">
21
- <text class="covered-price">¥?待开价</text>
22
- </block>
23
- <block wx:else>
24
- <view wx:if="{{product.discount_price && product.price && product.discount_price !== product.price}}" class="price-container">
25
- <text class="product-discount-price">¥{{product.discount_price}}</text>
26
- <text class="product-original-price">¥{{product.price}}</text>
27
- </view>
28
- <text wx:else class="product-price">¥{{product.discount_price || product.price || 0}}</text>
29
- </block>
30
- </view>
31
- <!-- 购买按钮 -->
32
- <view class="{{['buy-btn',(product.sale_status === 0 || product.covered_status === 1) ? 'disabled' : '']}}" catchtap="onBuyClick">
33
- 购买
34
- </view>
35
- </view>
@@ -1 +0,0 @@
1
- .product-image{border-radius:10rpx;height:180rpx;margin-right:20rpx;overflow:hidden;position:relative;width:180rpx}.product-index{border-radius:8rpx 0 8rpx 0;color:#fff;font-size:1rem;height:40rpx;padding:0 16rpx;z-index:1}.product-index,.product-mask{align-items:center;background-color:rgba(0,0,0,.6);display:flex;justify-content:center;left:0;position:absolute;top:0}.product-mask{bottom:0;right:0;z-index:2}.product-mask-text{color:#fff;font-size:1rem}.buy-btn.disabled{cursor:not-allowed;opacity:.6}.covered-price{color:#999;font-size:1rem;margin-bottom:10rpx}.product-image image{height:100%;object-fit:cover;width:100%}.product-info{display:flex;flex:1;flex-direction:column;justify-content:space-between;width:0}.product-name{color:#333;font-size:1.12rem;line-height:1.43rem}.product-desc,.product-name{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden;text-overflow:ellipsis}.product-desc{color:#666;font-size:.9rem}.price-container{align-items:baseline;display:flex}.product-discount-price{color:#fb2626;font-size:1.14rem}.product-original-price{color:#999;font-size:.86rem;text-decoration:line-through}.product-price{color:#fb2626;font-size:1.14rem}.buy-btn{background-color:#fb2626;border-radius:40rpx;bottom:20rpx;color:#fff;font-size:.86rem;padding:10rpx 32rpx;position:absolute;right:20rpx}.product-item{border-bottom:1rpx solid #f0f0f0;cursor:pointer;display:flex;padding:20rpx 0;position:relative}.product-item:last-child{border-bottom:none}.product-sales{color:#999;font-size:.86rem}.product-badge{align-items:center;background-color:rgba(0,0,0,.6);bottom:0;color:#fff;display:flex;font-size:.71rem;justify-content:center;left:0;padding:8rpx;position:absolute;right:0;text-align:center;z-index:5}.product-badge-text{display:inline-block}
@@ -1,67 +0,0 @@
1
- Component({
2
- properties: {
3
- sdkInstance: {
4
- type: Object,
5
- value: null,
6
- observer: function(newVal) {
7
- if (newVal) {
8
- this.initStoreListener();
9
- }
10
- }
11
- },
12
- },
13
- data: {
14
- // 组件内部数据
15
- productList: [],
16
- webinarId: ''
17
- },
18
- lifetimes: {
19
- created() {
20
- // 组件创建时
21
- },
22
- attached() {
23
- // 组件挂载时
24
- if (this.properties.sdkInstance) {
25
- this.initStoreListener();
26
- this.setData({
27
- webinarId: this.properties.sdkInstance.store.get('webinarId'),
28
- });
29
- // // 初始加载商品数据
30
- // const productServer = this.properties.sdkInstance.get('productServer');
31
- // if (productServer) {
32
- // productServer.getProductList();
33
- // }
34
- }
35
- },
36
- detached() {
37
- // 组件卸载时
38
- if (this.unsub) {
39
- this.unsub();
40
- }
41
- }
42
- },
43
- methods: {
44
- // 初始化store监听
45
- initStoreListener() {
46
- if (this.unsub) {
47
- this.unsub();
48
- }
49
-
50
- this.unsub = this.properties.sdkInstance.store.get({
51
- productList: (val) => {
52
- if (val) {
53
- this.setData({ productList: val });
54
- }
55
- }
56
- });
57
- },
58
- // 打开商品详情
59
- openProductDetail(e) {
60
- this.triggerEvent('productClick', e.detail);
61
- },
62
- // 处理购买点击事件
63
- onBuyClick(e) {
64
- this.triggerEvent('buyClick', e.detail);
65
- },
66
- },
67
- });
@@ -1,6 +0,0 @@
1
- {
2
- "component": true,
3
- "usingComponents": {
4
- "product-item": "../product-item/product-item"
5
- }
6
- }
@@ -1,16 +0,0 @@
1
- <view class="product-container">
2
- <view class="product-list">
3
- <view wx:if="{{productList.length === 0}}" class="product-empty">暂无商品</view>
4
- <view wx:else>
5
- <product-item
6
- webinarId="{{webinarId}}"
7
- wx:for="{{productList}}"
8
- wx:key="{{item.id}}"
9
- index="{{index}}"
10
- product="{{item}}"
11
- bind:openDetail="openProductDetail"
12
- bind:buyClick="onBuyClick"
13
- />
14
- </view>
15
- </view>
16
- </view>
@@ -1 +0,0 @@
1
- .product-container{height:100%}.product-list{box-sizing:border-box;height:100%;overflow-y:auto;padding:20rpx;width:100%}.product-empty{color:#999;font-size:1rem;padding:40rpx 0;text-align:center}
@@ -1,394 +0,0 @@
1
- import { appendParamsToPath } from '../../../shared/utils.js';
2
- Component({
3
- properties: {
4
- // 商品数据
5
- product: {
6
- type: Object,
7
- value: {}
8
- },
9
- // 是否显示
10
- show: {
11
- type: Boolean,
12
- value: false
13
- },
14
- // SDK实例
15
- sdkInstance: {
16
- type: Object,
17
- value: null
18
- }
19
- },
20
- data: {
21
- // 购买数量
22
- quantity: 1,
23
- // 小计金额
24
- subtotal: 0,
25
- // 总计金额
26
- total: 0,
27
- // 格式化后的金额显示
28
- subtotalText: '0.00',
29
- totalText: '0.00',
30
- // 直播间ID
31
- webinarId: '',
32
- // 微信商户AppID
33
- mchAppId: '',
34
- // 配置信息
35
- enablePhone: 0,
36
- enableRemark: 0,
37
- enableUsername: 0,
38
- // 用户输入信息
39
- phone: '',
40
- remark: '',
41
- username: ''
42
- },
43
- lifetimes: {
44
- attached() {
45
- // 组件挂载时初始化配置
46
- this.getWebinarSetting();
47
- }
48
- },
49
- observers: {
50
- // 监听显示状态变化(兼容旧用法)
51
- show: function(show) {
52
- if (show) {
53
- // 重置数量
54
- this.setData({
55
- quantity: 1,
56
- phone: '',
57
- remark: '',
58
- username: ''
59
- });
60
- this.updateAmount();
61
- this.getWebinarSetting();
62
- }
63
- },
64
- // 监听数量变化
65
- quantity: function(val) {
66
- this.updateAmount();
67
- },
68
- // 监听商品变化
69
- product: function(newVal) {
70
- if (newVal) {
71
- this.updateAmount();
72
- }
73
- }
74
- },
75
- methods: {
76
- // 获取商户号
77
- getMchAppId() {
78
- // 可以在这里调用接口获取商户号
79
- // 目前使用默认值
80
- },
81
- // 获取直播间配置信息
82
- async getWebinarSetting() {
83
- if (!this.properties.sdkInstance) {
84
- return;
85
- }
86
-
87
- const wxApi = this.properties.sdkInstance.wxApi;
88
- const webinarId = this.properties.sdkInstance.webinarId;
89
-
90
- try {
91
- const res = await wxApi.sendGet(`/v3/goods/webinar-setting/get-info?webinar_id=${webinarId}`);
92
-
93
- if (res && res.code === 200 && res.data) {
94
- this.setData({
95
- enablePhone: res.data.enable_phone || 0,
96
- enableRemark: res.data.enable_remark || 0,
97
- enableUsername: res.data.enable_username || 0,
98
- phone: res.data.phone || '',
99
- username: res.data.username || ''
100
- });
101
- }
102
- } catch (error) {
103
- console.error('获取直播间配置失败:', error);
104
- }
105
- },
106
- // 输入手机号
107
- onPhoneInput(e) {
108
- this.setData({
109
- phone: e.detail.value
110
- });
111
- },
112
- // 输入备注
113
- onRemarkInput(e) {
114
- this.setData({
115
- remark: e.detail.value
116
- });
117
- },
118
- // 输入昵称
119
- onUsernameInput(e) {
120
- this.setData({
121
- username: e.detail.value
122
- });
123
- },
124
- // 更新金额
125
- updateAmount() {
126
- const product = this.properties.product;
127
- const quantity = this.data.quantity;
128
- const price = parseFloat(product.discount_price || product.price || 0);
129
-
130
- // 确保价格是有效数字
131
- const validPrice = isNaN(price) ? 0 : price;
132
- const subtotal = validPrice * quantity;
133
- const total = subtotal; // 暂不考虑运费
134
-
135
- this.setData({
136
- subtotal: subtotal,
137
- total: total,
138
- subtotalText: subtotal.toFixed(2),
139
- totalText: total.toFixed(2)
140
- });
141
- },
142
- // 减少数量
143
- decreaseQty() {
144
- if (this.data.quantity > 1) {
145
- this.setData({
146
- quantity: this.data.quantity - 1
147
- });
148
- }
149
- },
150
- // 增加数量
151
- increaseQty() {
152
- const stock = parseInt(this.properties.product.stock || 999);
153
- if (this.data.quantity < stock) {
154
- this.setData({
155
- quantity: this.data.quantity + 1
156
- });
157
- } else {
158
- wx.showToast({
159
- title: '库存不足',
160
- icon: 'none',
161
- duration: 2000
162
- });
163
- }
164
- },
165
- // 关闭订单页面
166
- closeOrder() {
167
- this.setData({
168
- show: false
169
- });
170
- this.triggerEvent('close');
171
- },
172
- // 提交订单
173
- async submitOrder() {
174
- const product = this.properties.product;
175
- const quantity = this.data.quantity;
176
-
177
- // 检查商品状态
178
- if (product.sale_status === 0) {
179
- wx.showToast({
180
- title: '商品已抢光',
181
- icon: 'none',
182
- duration: 2000
183
- });
184
- return;
185
- }
186
-
187
- if (product.covered_status === 1) {
188
- wx.showToast({
189
- title: '商品待开价',
190
- icon: 'none',
191
- duration: 2000
192
- });
193
- return;
194
- }
195
-
196
- // 检查 buy_type
197
- if (product.buy_type === 4 && product?.mini_program_config?.mini_program_path) {
198
- // 跳转到小程序路径
199
- const webinarId = this.properties.sdkInstance.store.get('webinarId');
200
- wx.navigateTo({
201
- url: appendParamsToPath(product?.mini_program_config?.mini_program_path, { webinarId })
202
- });
203
- this.closeOrder();
204
- return;
205
- }
206
-
207
- // 只有 buy_type === 1 时才调用创建订单接口
208
- if (product.buy_type !== 1) {
209
- wx.showToast({
210
- title: '无法购买,请联系主办方',
211
- icon: 'none',
212
- duration: 2000
213
- });
214
- return;
215
- }
216
-
217
- // 验证必填字段
218
- if (this.data.enableUsername && !this.data.username.trim()) {
219
- wx.showToast({
220
- title: '请输入昵称',
221
- icon: 'none',
222
- duration: 2000
223
- });
224
- return;
225
- }
226
-
227
- if (this.data.enablePhone) {
228
- const phone = this.data.phone.trim();
229
- if (!phone) {
230
- wx.showToast({
231
- title: '请输入手机号',
232
- icon: 'none',
233
- duration: 2000
234
- });
235
- return;
236
- }
237
- // 校验手机号格式(11位数字,以1开头)
238
- const phoneReg = /^1[0-9]\d{9}$/;
239
- if (!phoneReg.test(phone)) {
240
- wx.showToast({
241
- title: '请输入正确的手机号',
242
- icon: 'none',
243
- duration: 2000
244
- });
245
- return;
246
- }
247
- }
248
-
249
- // 调用创建订单接口
250
- await this.createOrder(product, quantity);
251
- },
252
-
253
- // 创建订单
254
- async createOrder(product, quantity) {
255
- if (!this.properties.sdkInstance) {
256
- console.error('sdkInstance 不存在');
257
- return;
258
- }
259
-
260
- const wxApi = this.properties.sdkInstance.wxApi;
261
- const webinarId = this.properties.sdkInstance.webinarId;
262
- const wxAppId = this.properties.sdkInstance.wxAppId;
263
- const userInfo = this.properties.sdkInstance.store.get('user') || {};
264
-
265
- // 构建请求参数
266
- const params = {
267
- channel_source: 'main',
268
- coupon_user_ids: [],
269
- ext: {
270
- watch_url: `https://test-live.vhall.com/v3/lives/watch/${webinarId}`
271
- },
272
- goods: [
273
- {
274
- goods_id: product.goods_id,
275
- quantity: quantity,
276
- goods_sku_id: '',
277
- buy_type: product.buy_type
278
- }
279
- ],
280
- mch_app_id: wxAppId,
281
- nickname: userInfo.nickname || '',
282
- open_id: userInfo.openId || userInfo.open_id || '',
283
- pay_amount: this.data.total.toFixed(2),
284
- pay_channel: 'WEIXIN',
285
- phone: this.data.phone || userInfo.phone || '',
286
- remark: this.data.remark || '',
287
- service_code: 'JSAPI',
288
- show_url: `https://test-live.vhall.com/v3/lives/watch/${webinarId}`,
289
- third_user_id: null,
290
- username: this.data.username || userInfo.username || userInfo.nickname || ''
291
- };
292
-
293
- try {
294
- wx.showLoading({ title: '提交中...' });
295
-
296
- const res = await wxApi.sendPost('/v3/goods/order/create', params);
297
-
298
- wx.hideLoading();
299
-
300
- if (res && res.code == 200) {
301
- // 订单创建成功,调用支付
302
- await this.requestPayment(res.data);
303
- } else {
304
- // 订单创建失败
305
- wx.showToast({
306
- title: res.msg || '订单创建失败',
307
- icon: 'none',
308
- duration: 2000
309
- });
310
- }
311
- } catch (error) {
312
- wx.hideLoading();
313
- console.error('创建订单失败:', error);
314
- wx.showToast({
315
- title: '创建订单失败',
316
- icon: 'none',
317
- duration: 2000
318
- });
319
- }
320
- },
321
-
322
- // 调用微信支付
323
- async requestPayment(orderInfo) {
324
- if (!orderInfo || !orderInfo.ext) {
325
- console.error('支付参数错误');
326
- wx.showToast({
327
- title: '支付参数错误',
328
- icon: 'none',
329
- duration: 2000
330
- });
331
- return;
332
- }
333
-
334
- let payParams;
335
- try {
336
- payParams = JSON.parse(orderInfo.ext);
337
- } catch (e) {
338
- console.error('解析支付参数失败:', e);
339
- wx.showToast({
340
- title: '支付参数解析失败',
341
- icon: 'none',
342
- duration: 2000
343
- });
344
- return;
345
- }
346
-
347
- try {
348
- wx.showLoading({ title: '支付中...' });
349
-
350
- // 使用 await 方式,不使用 success/fail 回调
351
- const result = await wx.requestPayment(payParams);
352
-
353
- wx.hideLoading();
354
-
355
- if (result && result.errMsg === 'requestPayment:ok') {
356
- // 支付成功
357
- wx.showToast({
358
- title: '支付成功',
359
- icon: 'success',
360
- duration: 2000
361
- });
362
-
363
- // 关闭订单页面
364
- this.closeOrder();
365
-
366
- // 触发支付成功事件
367
- this.triggerEvent('paySuccess', {
368
- product: this.properties.product,
369
- quantity: this.data.quantity,
370
- total: this.data.total,
371
- orderInfo: orderInfo
372
- });
373
- }
374
- } catch (error) {
375
- wx.hideLoading();
376
- console.error('支付失败:', error);
377
-
378
- if (error && error.errMsg && error.errMsg.includes('cancel')) {
379
- wx.showToast({
380
- title: '已取消支付',
381
- icon: 'none',
382
- duration: 2000
383
- });
384
- } else {
385
- wx.showToast({
386
- title: '支付失败',
387
- icon: 'none',
388
- duration: 2000
389
- });
390
- }
391
- }
392
- }
393
- }
394
- });
@@ -1,3 +0,0 @@
1
- {
2
- "component": true
3
- }