pickVideo.nvue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  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="num=$event.length" />
  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: false,
  56. linkMic: true,
  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.tenantCode = options.tenantCode,
  69. this.orderId = options.orderId
  70. this.userData = uni.getStorageSync("userData");
  71. let info = uni.getSystemInfoSync();
  72. this.windowWidth = info.windowWidth;
  73. this.windowHeight = info.windowHeight;
  74. },
  75. onReady() {
  76. this.init();
  77. },
  78. methods: {
  79. init() {
  80. NET.request(API.linkPickVideo, {
  81. tenantCode : this.tenantCode,
  82. orderId: this.orderId
  83. }, 'GET').then(res => {
  84. this.title = res.data.tenantName;
  85. this.avatar = res.data.headImg;
  86. this.liveId = res.data.liveId;
  87. this.roomId = res.data.roomId;
  88. this.goodsList = res.data.liveProducResVO;
  89. this.$nextTick(() => this.enterRoom());
  90. }).catch(error => {
  91. uni.showToast({
  92. title: error.data.msg,
  93. duration: 2000
  94. });
  95. });
  96. },
  97. enterRoom() {
  98. this.$refs.jhlive&&this.$refs.jhlive.enterRoom();
  99. },
  100. exitRoom() {
  101. this.$refs.jhlive&&this.$refs.jhlive.exitRoom();
  102. },
  103. onBtnClick(index, item) {
  104. if(index === 0) {
  105. this.$refs.popup.open()
  106. }
  107. },
  108. }
  109. }
  110. </script>
  111. <style lang="less" scoped>
  112. .container {
  113. position: relative;
  114. display: flex;
  115. flex-direction: column;
  116. align-items: stretch;
  117. width: 750rpx;
  118. }
  119. .jhlive {
  120. width: 750rpx;
  121. flex: 1;
  122. }
  123. .popup-open {
  124. width: 50px;
  125. height: 50px;
  126. position: fixed;
  127. bottom: 15px;
  128. right: 15px;
  129. background-color: #52A63A;
  130. border-radius: 50%;
  131. text-align: center;
  132. line-height: 50px;
  133. }
  134. .iconzhibo-shangpin {
  135. color: #FFFFFF;
  136. font-size: 34px;
  137. text-align: center;
  138. line-height: 50px;
  139. }
  140. .popup-box {
  141. background-color: #FFFFFF;
  142. width: 750rpx;
  143. height: 750rpx;
  144. border-top-left-radius: 10px;
  145. border-top-right-radius: 10px;
  146. }
  147. .popup-close {
  148. padding: 10px;
  149. line-height: 16px;
  150. }
  151. .popup-close-text {
  152. color: #52A63A;
  153. font-size: 15px;
  154. font-family: PingFang SC;
  155. text-align: left;
  156. }
  157. .good-box {
  158. width: 750rpx;
  159. height: 230px;
  160. padding: 0 0 10px 0;
  161. overflow: visible;
  162. }
  163. .goods-row:first-child {
  164. margin-top: 12px;
  165. }
  166. .goods-row {
  167. width: 700rpx;
  168. height: 104px;
  169. display: flex;
  170. flex-direction: row;
  171. flex-wrap: nowrap;
  172. background-color: #FFFFFF;
  173. box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.1);
  174. border-radius: 5px;
  175. margin: 0 15px 10px 15px;
  176. }
  177. .goods-img-box {
  178. margin-right: 15px;
  179. }
  180. .goods-img {
  181. width: 104px;
  182. height: 104px;
  183. object-fit: cover;
  184. }
  185. .goods-info {
  186. flex: 1;
  187. padding-top: 10px;
  188. }
  189. .goods-name {
  190. line-height: 15px;
  191. overflow: hidden;
  192. display: -webkit-box;
  193. -webkit-line-clamp: 2;
  194. -webkit-box-orient: vertical;
  195. word-wrap: break-word;
  196. text-overflow: ellipsis;
  197. font-size: 15px;
  198. font-family: PingFang SC;
  199. color: #333333;
  200. }
  201. .goods-sales {
  202. font-size: 12px;
  203. font-family: PingFang SC;
  204. color: #666666;
  205. line-height: 15px;
  206. margin: 8px 0 8px 0;
  207. }
  208. .price {
  209. font-size: 12px;
  210. text-decoration: line-through;
  211. color: #A67954;
  212. }
  213. .goods-number-bottom {
  214. display: flex;
  215. flex-direction: row;
  216. }
  217. .goods-number {
  218. display: flex;
  219. flex-direction: row;
  220. white-space: nowrap;
  221. line-height: 24px;
  222. }
  223. .goods-number-left {
  224. font-size: 12px;
  225. color: #666666;
  226. }
  227. .goods-icon {
  228. font-size: 14px;
  229. font-family: PingFang SC;
  230. color: #52A63A;
  231. }
  232. .goods-spec {
  233. font-size: 24px;
  234. font-family: PingFang SC;
  235. color: #52A63A;
  236. }
  237. .more-button {
  238. width: 24px;
  239. height: 24px;
  240. position: absolute;
  241. right: 16px;
  242. }
  243. .more-button-iconfont {
  244. font-size: 36px;
  245. color: #999999;
  246. text-align: center;
  247. }
  248. </style>