pickVideo.nvue 5.9 KB

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