index.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  1. <template>
  2. <view class="index-content" :style="{'--status-bar-': statusBarHeight}">
  3. <view class="index-content-info">
  4. <!-- 头部主要内容 开始 -->
  5. <view class="index-content-header">
  6. <customNavbar
  7. title="全民分享"
  8. bgColor="rgba(0,0,0,0)"
  9. :is-left="false"
  10. :customNavbarInfo='{}'>
  11. <view slot="right">
  12. <image @click="getRetailQrcode()" style="width: 44rpx;height: 44rpx;" :src="fengxiang" mode=""></image>
  13. </view>
  14. </customNavbar>
  15. <u-search
  16. @clickIcon="navigateToFun('/pages/index/search')"
  17. @custom="navigateToFun('/pages/index/search')"
  18. @focus="navigateToFun('/pages/index/search')"
  19. :showAction="true"
  20. bgColor="#fff"
  21. actionText="搜索">
  22. </u-search>
  23. </view>
  24. <!-- 头部主要内容 结束 -->
  25. <!-- 列表主要内容 开始 -->
  26. <view class="index-content-list">
  27. <customScrollList
  28. ref="customScrollList"
  29. @load="load"
  30. @paging="paging"
  31. @refresh="refresh"
  32. >
  33. <view class="index-content-list-info" v-if="retailIndex.length>0">
  34. <text class="index-content-list-class">剧目</text>
  35. <view
  36. class="index-content-list-item"
  37. v-for="(item,index) in retailIndex"
  38. :key="index">
  39. <view class="index-content-list-content">
  40. <image
  41. class="index-content-list-image"
  42. :src="item.showImg" mode="scaleToFill"></image>
  43. <view class="index-content-list-tool">
  44. <text class="index-content-list-title">{{ item.name }}</text>
  45. <text
  46. class="index-content-list-but"
  47. @click="navigateToFun('/pages/publicSharingDetails/index',{ performId: item.id})"
  48. >查看</text>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. </customScrollList>
  54. </view>
  55. <!-- 列表主要内容 结束 -->
  56. </view>
  57. <!-- 我的分享码 -->
  58. <customPromotionCode ref="customPromotionCode" />
  59. <!-- 入网认证 -->
  60. <u-modal
  61. :show="show"
  62. :title="title1"
  63. :content='content'
  64. cancelText='取消'
  65. :confirmText='confirmText'
  66. showCancelButton
  67. confirmColor='#ED0000'
  68. @confirm='networkConfirm'
  69. @cancel='networkCancel'
  70. @close='networkCancel'
  71. ></u-modal>
  72. </view>
  73. </template>
  74. <script>
  75. import {
  76. navigateTo
  77. } from "@/utils/util.js"
  78. export default {
  79. data() {
  80. return {
  81. title: '全民分享',
  82. loading: false,
  83. statusBarHeight: 0, // 状态栏安全距离
  84. retailIndex: [], // 剧目列表
  85. fengxiang: this.$commonConfig.staticUrl+'index/fengxiang.png',
  86. // 入网认证
  87. isShowQrcode: -1, // 是否展示 推广码
  88. show: false,
  89. title1:'入网提示',
  90. content:'你还未进行银联支付入网签约认证,请先完成签约认证!',
  91. confirmText: '去认证',
  92. }
  93. },
  94. onLoad() {
  95. },
  96. onShow() {
  97. this.statusBarHeight = getApp().globalData.statusBarHeight
  98. //this.load()
  99. },
  100. methods: {
  101. async load(paging){
  102. console.log("上拉 加载数据")
  103. try{
  104. let res = await this.$u.api.retailIndex({
  105. "page": paging.page,
  106. "pages": paging.size,
  107. })
  108. if(res && res.code ===200) {
  109. if(res.data.performList){
  110. this.retailIndex = this.retailIndex.concat(res.data.performList)
  111. }else {
  112. this.retailIndex = []
  113. }
  114. this.$refs.customScrollList.loadSuccess({
  115. list: this.retailIndex,
  116. total: this.retailIndex.length
  117. })
  118. } else {
  119. this.$refs.customScrollList.loadSuccess({
  120. list: [],
  121. total: 0
  122. })
  123. }
  124. }catch(e){
  125. //TODO handle the exception
  126. console.error("e===",e)
  127. this.$refs.customScrollList.loadSuccess({
  128. list: [],
  129. total: 0
  130. })
  131. }
  132. },
  133. paging(){
  134. console.log("下拉 加载数据")
  135. },
  136. /**
  137. * 下拉触底
  138. */
  139. async refresh(paging){
  140. console.log("上拉 加载数据",this.retailIndex)
  141. //this.$refs.customScrollList.showEmpty = true
  142. try{
  143. //this.$refs.customScrollList.showPullUp = true
  144. let res = await this.$u.api.retailIndex({
  145. pageNum: paging.page,
  146. pageSize: paging.size
  147. })
  148. if(res && res.code ===200) {
  149. if(res.data.performList){
  150. this.retailIndex = [].concat(res.data.performList)
  151. }else {
  152. this.retailIndex = []
  153. }
  154. // this.retailIndex = null
  155. this.$refs.customScrollList.refreshSuccess({
  156. list: this.retailIndex,
  157. total: this.retailIndex.length
  158. })
  159. } else {
  160. this.$refs.customScrollList.refreshSuccess({
  161. list: [],
  162. total: 0
  163. })
  164. }
  165. }catch(e){
  166. //TODO handle the exception
  167. console.error("e===",e)
  168. this.$refs.customScrollList.refreshSuccess({
  169. list: [],
  170. total: 0
  171. })
  172. }
  173. },
  174. /**
  175. * @author ygh
  176. * @data 2023-12-20
  177. */
  178. navigateToFun(url,data={}) {
  179. console.log("dsffd",data)
  180. navigateTo(url,data)
  181. },
  182. /**
  183. * 我的推广码
  184. */
  185. async getRetailQrcode(){
  186. try{
  187. await this.getUserInfo()
  188. if(this.isShowQrcode != 1) {
  189. if(this.isShowQrcode == 0) {
  190. this.content = '你还未进行银联支付入网签约认证,请先完成签约认证!'
  191. this.confirmText = '去认证'
  192. }else if(this.isShowQrcode == 2) {
  193. this.content = '银联支付入网签约认证中,请耐心等待!'
  194. this.confirmText = '去查看'
  195. }else if(this.isShowQrcode == 3) {
  196. this.content = '银联支付入网签约认证失败,请重新认证!'
  197. this.confirmText = '重新认证'
  198. }
  199. this.show = true
  200. }else {
  201. let res = await this.$u.api.getRetailQrcode({
  202. noSign: 1,
  203. userid: this.distribution_user_info.userId
  204. })
  205. if(res && res.code ===200) {
  206. this.$refs.customPromotionCode.initData(res.data)
  207. // #ifdef H5
  208. //window.history.pushState(null, null, document.URL)
  209. // #endif
  210. }
  211. }
  212. }catch(e){
  213. //TODO handle the exception
  214. console.error("e===",e)
  215. }
  216. },
  217. /** 入网认证 */
  218. networkConfirm() {
  219. this.show = false
  220. this.navigateToFun('/pages/networkAuth/index')
  221. //this.getUnionAccessUrlFun()
  222. },
  223. networkCancel() {
  224. this.show = false
  225. },
  226. /**
  227. * 获取用户信息
  228. */
  229. async getUserInfo() {
  230. try{
  231. let res = await this.$u.api.getInfo({
  232. noSign: 1,
  233. userid: this.distribution_user_info.userId
  234. })
  235. if(res && res.code ===200) {
  236. this.isShowQrcode = res.data.unionFlag
  237. }
  238. }catch(e){
  239. //TODO handle the exception
  240. console.error("e===",e)
  241. this.isShowQrcode = -1
  242. }
  243. },
  244. /** 银联签约入网地址 */
  245. async getUnionAccessUrlFun(){
  246. try{
  247. let res = await this.$u.api.getUnionAccessUrl({
  248. userid: this.distribution_user_info.userId
  249. })
  250. if(res && res.code ===200) {
  251. this.show = false
  252. location.href = res.data.jumpUrl
  253. } else {
  254. this.show = true
  255. }
  256. }catch(e){
  257. //TODO handle the exception
  258. this.show = true
  259. console.error("e===",e)
  260. }
  261. }
  262. }
  263. }
  264. </script>
  265. <style lang="scss" scoped>
  266. .index-content {
  267. display: flex;
  268. flex-direction: column;
  269. align-items: center;
  270. justify-content: center;
  271. box-sizing: border-box;
  272. --header-h: 170rpx;
  273. // background-color:
  274. .index-content-info {
  275. width: 100%;
  276. box-sizing: border-box;
  277. }
  278. }
  279. /** 头部主要内容 开始 */
  280. .index-content-header {
  281. width: 100%;
  282. height: var(--header-h);
  283. box-sizing: border-box;
  284. background-color: var(--gd-bgm-color);
  285. ::v-deep .u-search {
  286. padding: 0 30rpx !important;
  287. }
  288. ::v-deep .u-search__action {
  289. color: #fff !important;
  290. }
  291. }
  292. /** 头部主要内容 结束 **/
  293. /** 列表主要内容 开始 */
  294. .index-content-list {
  295. width: 100%;
  296. height: calc( 100% - var(--header-h) - var(--status-bar-h) );
  297. }
  298. .index-content-list-info {
  299. width: 100%;
  300. box-sizing: border-box;
  301. padding: 32rpx 32rpx 150rpx;
  302. .index-content-list-class {
  303. font-size: 32rpx;
  304. font-family: SourceHanSansCN, SourceHanSansCN;
  305. font-weight: bold;
  306. color: #2D2D2D;
  307. }
  308. .index-content-list-item {
  309. width: 100%;
  310. box-sizing: border-box;
  311. background: #FFFFFF;
  312. box-shadow: 0rpx 2rpx 20rpx 0rpx rgba(200,200,200,0.5);
  313. border-radius: 24rpx;
  314. overflow: hidden;
  315. margin-top: 40rpx;
  316. .index-content-list-content {
  317. width: 100%;
  318. box-sizing: border-box;
  319. .index-content-list-image {
  320. width: 100%;
  321. height: 242rpx;
  322. }
  323. .index-content-list-tool {
  324. display: flex;
  325. width: 100%;
  326. justify-content: space-between;
  327. align-items: center;
  328. padding:42rpx 28rpx 46rpx;
  329. box-sizing: border-box;
  330. .index-content-list-title {
  331. font-size: 28rpx;
  332. font-family: SourceHanSansCN, SourceHanSansCN;
  333. font-weight: bold;
  334. color: #363636;
  335. }
  336. .index-content-list-but {
  337. width: 160rpx;
  338. height: 51rpx;
  339. background: #ED0000;
  340. border-radius: 24rpx;
  341. font-size: 20rpx;
  342. font-family: PingFangSC, PingFang SC;
  343. font-weight: 400;
  344. color: #FFFFFF;
  345. display: flex;
  346. justify-content: center;
  347. align-items: center;
  348. }
  349. }
  350. }
  351. }
  352. }
  353. /** 列表主要内容 结束 **/
  354. </style>