pickVideo.nvue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. <template>
  2. <view class="container" :style="'height: '+windowHeight+'px;'">
  3. <jhlive
  4. ref="jhlive" class="jhlive"
  5. :sdkAppID="sdkAppID" :secretKey="secretKey" :userId="userId" :roomId="roomId"
  6. :isAuthor="isAuthor" :linkMic="linkMic"
  7. :avatar="avatar" :subtitle="num?'已连接':'等待用户进入'" :title="title"
  8. :btns="btns" @onBtnClick="onBtnClick"
  9. @onRemoteUser="handleRemoteUser" />
  10. <uni-popup ref="popup" animation type="bottom">
  11. <view class="popup-box">
  12. <view class="popup-close">
  13. <text class="popup-close-text" @click="$refs.popup.close()">收起</text>
  14. </view>
  15. <scroll-view scroll-y="true" class="good-box">
  16. <view class="goods-row" v-for="(item, index) in goodsList" :key="index">
  17. <view class="goods-img-box">
  18. <image class="goods-img" :src="item.imgPath" mode="aspectFill"></image>
  19. </view>
  20. <view class="goods-info">
  21. <view>
  22. <text class="goods-name">{{item.productName}}</text>
  23. </view>
  24. <text class="goods-sales">{{item.sellCount ? item.sellCount : 0}}人付款</text>
  25. <text class="price">原价:{{item.originalPrice}}</text>
  26. <view class="goods-number-bottom">
  27. <view class="goods-number">
  28. <!-- <text class="goods-number-left">惊爆价:</text> -->
  29. <text class="goods-icon">¥</text>
  30. <text class="goods-spec">{{item.bizPrice}}</text>
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. </scroll-view>
  36. </view>
  37. </uni-popup>
  38. </view>
  39. </template>
  40. <script>
  41. import jhlive from "@/jhlive/jhlive";
  42. const NET = require('@/utils/request')
  43. const API = require('@/config/api')
  44. export default {
  45. components: { jhlive },
  46. data() {
  47. return {
  48. windowWidth: 0,
  49. windowHeight: 0,
  50. userData: {},
  51. orderId: '',
  52. tenantCode: '',
  53. goodsList: [],
  54. liveId: '',
  55. isAuthor: true,
  56. linkMic: false,
  57. sdkAppID:API.sdkAppID,
  58. secretKey:API.secretKey,
  59. btns: [{picture:"../static/images/live-good.png",title:''}],
  60. userId: '',
  61. roomId: '',
  62. title: "暂无",
  63. num: 0,
  64. avatar: "../static/images/loginLogo.png",
  65. }
  66. },
  67. onLoad(options) {
  68. this.orderId = options.orderId
  69. this.userData = uni.getStorageSync("userData");
  70. let info = uni.getSystemInfoSync();
  71. this.windowWidth = info.windowWidth;
  72. this.windowHeight = info.windowHeight;
  73. },
  74. onReady() {
  75. this.init();
  76. },
  77. methods: {
  78. init() {
  79. NET.request(API.creatPickVideo, {orderId: this.orderId}, 'GET').then(res => {
  80. this.liveId = res.data.liveId
  81. this.roomId = res.data.roomId;
  82. this.goodsList = res.data.liveProducResVO
  83. this.$nextTick(() => this.enterRoom());
  84. }).catch(error => {
  85. uni.showToast({
  86. title: error.data.msg,
  87. duration: 2000
  88. });
  89. })
  90. },
  91. enterRoom() {
  92. this.$refs.jhlive&&this.$refs.jhlive.enterRoom();
  93. },
  94. exitRoom() {
  95. this.$refs.jhlive&&this.$refs.jhlive.exitRoom();
  96. },
  97. handleRemoteUser(users) {
  98. this.subtitle = users.length;
  99. users.length&&this.request(API.getMainInfo +"?userId="+ users[0], {}, 'GET').then(res => {
  100. this.avatar = res.data.headimg;
  101. this.title = res.data.nickname;
  102. }).catch(error => {
  103. uni.showToast({
  104. title: error.data.msg,
  105. duration: 2000
  106. });
  107. })
  108. },
  109. onBtnClick(index, item) {
  110. if(index === 0) {
  111. this.$refs.popup.open()
  112. }
  113. },
  114. }
  115. }
  116. </script>
  117. <style lang="less" scoped>
  118. .container {
  119. position: relative;
  120. display: flex;
  121. flex-direction: column;
  122. align-items: stretch;
  123. width: 750rpx;
  124. }
  125. .jhlive {
  126. width: 750rpx;
  127. flex: 1;
  128. }
  129. .popup-open {
  130. width: 50px;
  131. height: 50px;
  132. position: fixed;
  133. bottom: 15px;
  134. right: 15px;
  135. background-color: #52A63A;
  136. border-radius: 50%;
  137. text-align: center;
  138. line-height: 50px;
  139. }
  140. .iconzhibo-shangpin {
  141. color: #FFFFFF;
  142. font-size: 34px;
  143. text-align: center;
  144. line-height: 50px;
  145. }
  146. .popup-box {
  147. background-color: #FFFFFF;
  148. width: 750rpx;
  149. height: 750rpx;
  150. border-top-left-radius: 10px;
  151. border-top-right-radius: 10px;
  152. }
  153. .popup-close {
  154. padding: 10px;
  155. line-height: 16px;
  156. }
  157. .popup-close-text {
  158. color: #52A63A;
  159. font-size: 15px;
  160. font-family: PingFang SC;
  161. text-align: left;
  162. }
  163. .good-box {
  164. width: 750rpx;
  165. height: 230px;
  166. padding: 0 0 10px 0;
  167. overflow: visible;
  168. }
  169. .goods-row:first-child {
  170. margin-top: 12px;
  171. }
  172. .goods-row {
  173. width: 700rpx;
  174. height: 104px;
  175. display: flex;
  176. flex-direction: row;
  177. flex-wrap: nowrap;
  178. background-color: #FFFFFF;
  179. box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.1);
  180. border-radius: 5px;
  181. margin: 0 15px 10px 15px;
  182. }
  183. .goods-img-box {
  184. margin-right: 15px;
  185. }
  186. .goods-img {
  187. width: 104px;
  188. height: 104px;
  189. object-fit: cover;
  190. }
  191. .goods-info {
  192. flex: 1;
  193. padding-top: 10px;
  194. }
  195. .goods-name {
  196. line-height: 15px;
  197. overflow: hidden;
  198. display: -webkit-box;
  199. -webkit-line-clamp: 2;
  200. -webkit-box-orient: vertical;
  201. word-wrap: break-word;
  202. text-overflow: ellipsis;
  203. font-size: 15px;
  204. font-family: PingFang SC;
  205. color: #333333;
  206. }
  207. .goods-sales {
  208. font-size: 12px;
  209. font-family: PingFang SC;
  210. color: #666666;
  211. line-height: 15px;
  212. margin: 8px 0 8px 0;
  213. }
  214. .price {
  215. font-size: 12px;
  216. text-decoration: line-through;
  217. color: #A67954;
  218. }
  219. .goods-number-bottom {
  220. display: flex;
  221. flex-direction: row;
  222. }
  223. .goods-number {
  224. display: flex;
  225. flex-direction: row;
  226. white-space: nowrap;
  227. line-height: 24px;
  228. }
  229. .goods-number-left {
  230. font-size: 12px;
  231. color: #666666;
  232. }
  233. .goods-icon {
  234. font-size: 14px;
  235. font-family: PingFang SC;
  236. color: #52A63A;
  237. }
  238. .goods-spec {
  239. font-size: 24px;
  240. font-family: PingFang SC;
  241. color: #52A63A;
  242. }
  243. </style>