my.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  1. <template>
  2. <view class="activity">
  3. <!-- #ifdef MP-ALIPAY -->
  4. <u-navbar title="我的拼团" :border="true" :placeholder="true" :autoBack="true" bgColor="#fff" leftIconSize="0" />
  5. <!-- #endif -->
  6. <!-- #ifdef MP-WEIXIN -->
  7. <u-navbar title="我的拼团" :border="true" :placeholder="true" :autoBack="true" bgColor="#fff" />
  8. <!-- #endif -->
  9. <!-- #ifndef MP-WEIXIN || MP-ALIPAY -->
  10. <view v-if="pagesNum > 1">
  11. <u-navbar :placeholder="true" bgColor="#fff" :autoBack="true" :border="true" title="我的拼团" />
  12. </view>
  13. <view v-else>
  14. <u-navbar leftIconSize="0" :placeholder="true" bgColor="#fff" :border="true" title="我的拼团">
  15. <view class="nav-left flex" slot="left" @click="$toIndex()">
  16. <u-icon name="arrow-left" size="20" color="#333"></u-icon>
  17. </view>
  18. </u-navbar>
  19. </view>
  20. <!-- #endif -->
  21. <view class="status">
  22. <u-tabs @change="changeTab" :scrollable="false" :list="statusArr" lineWidth="34" lineHeight="3"
  23. lineColor="#8E51F7" :activeStyle="{
  24. color: '#8E51F7',
  25. transform: 'scale(1)',
  26. width: '150rpx',
  27. }" :inactiveStyle="{
  28. color: '#666',
  29. transform: 'scale(1)',
  30. width: '150rpx'
  31. }" itemStyle="padding-left: 11px; padding-right: 11px; height: 44px;text-align: center; ">
  32. </u-tabs>
  33. </view>
  34. <view class="list">
  35. <view class="list-view lotteryResult" v-if="triggerStatus==1">
  36. <view class="lottery-inner" @click='toRecord()'>
  37. <view class="lottery-img">
  38. <image src="../../static/public/111.jpg" mode=""></image>
  39. </view>
  40. <view class="lottery-msg">
  41. <view class="lottery-title">轩妈蛋黄酥40g*4枚2袋装随心装</view>
  42. <view class="lottery-price"><text>¥</text>0.01</view>
  43. <button class="toGroup1 active" >已中奖</button>
  44. </view>
  45. </view>
  46. </view>
  47. <view class="list-view lotteryResult" v-if="triggerStatus==1">
  48. <view class="lottery-inner" @click='toRecord()'>
  49. <view class="lottery-img">
  50. <image src="../../static/public/111.jpg" mode=""></image>
  51. </view>
  52. <view class="lottery-msg">
  53. <view class="lottery-title">轩妈蛋黄酥40g*4枚2袋装随心装</view>
  54. <view class="lottery-price"><text>¥</text>0.01</view>
  55. <button class="toGroup1 notactive" >未中奖</button>
  56. </view>
  57. </view>
  58. </view>
  59. <view v-for="(item,index) in list1" :key="index" class="list-view" v-if="triggerStatus==0">
  60. <view class="lottery-inner" @click='toGroup()'>
  61. <view class="lottery-img">
  62. <image src="../../static/public/111.jpg" mode=""></image>
  63. </view>
  64. <view class="lottery-msg">
  65. <view class="lottery-title">轩妈蛋黄酥40g*4枚2袋装随心装</view>
  66. <view class="lottery-time">2023-12-31 12:00:00 截止</view>
  67. <view class="lottery-person">拼团进度:4/10人</view>
  68. <view class="lottery-price"><text>¥</text>0.01</view>
  69. <button class="toGroup" >拼团详情</button>
  70. </view>
  71. </view>
  72. </view>
  73. <view class="flex empty" v-if="!list.length && !loading && triggerStatus == 0">
  74. <view class="center">
  75. <image class="center-img"
  76. src="https://mp-public-1310078123.cos.ap-shanghai.myqcloud.com/static/lucky_empty_list.png" mode="scaleToFill"></image>
  77. <view class="center-font">新的活动正在准备中...</view>
  78. </view>
  79. </view>
  80. <view class="flex empty" v-if="!list.length && !loading && triggerStatus != 0">
  81. <view class="center">
  82. <image class="center-img"
  83. src="https://mp-public-1310078123.cos.ap-shanghai.myqcloud.com/static/lucky_empty_list.png" mode="scaleToFill"></image>
  84. <view class="center-font">还没有已开奖活动</view>
  85. </view>
  86. </view>
  87. </view>
  88. <u-loadmore :line="true" v-if="list.length>5" :status="status" :loading-text="'努力加载中'" :nomore-text="'已经到底了'" />
  89. <!-- <custom-tab-bar :activeValue="'activity'" /> -->
  90. </view>
  91. </template>
  92. <script>
  93. import env from '../../config/env.js'
  94. import $http from '@/utils/request.js'
  95. import appId from '@/config/appId.js'
  96. import CustomTabBar from '../../components/custom-tab-bar/custom-tab-bar.vue'
  97. export default {
  98. components: {
  99. CustomTabBar,
  100. },
  101. data() {
  102. return {
  103. status: 'nomore',//上拉刷新状态
  104. list: [],
  105. list1: [1,2,3,4],
  106. statusArr: [{
  107. name: '进行中'
  108. }, {
  109. name: '已开奖',
  110. }, {
  111. disabled: true
  112. }, {
  113. disabled: true
  114. }, {
  115. disabled: true
  116. }],
  117. triggerStatus: 0,
  118. userInfo: '',
  119. pageNum: 1,
  120. total: 0,
  121. }
  122. },
  123. onLoad(opthios) {
  124. if (opthios.triggerStatus) {
  125. this.triggerStatus = opthios.triggerStatus
  126. }
  127. if (opthios.userId) {
  128. uni.setStorageSync('shareUid', opthios.userId != 'undefined'?opthios.userId:null)
  129. if (opthios.userId === undefined || opthios.userId === 'undefined') {
  130. uni.getSystemInfo({
  131. success(res) {
  132. log.error(
  133. `基础库:${ res.SDKVersion },设备:${ res.model }-${ res.system },页面:/pages/activity/index.vue.`
  134. )
  135. }
  136. })
  137. }
  138. }
  139. if (opthios.type) {
  140. uni.setStorageSync('shareType', opthios.type)
  141. }
  142. },
  143. onShow() {
  144. if(uni.getStorageSync('token')) {
  145. this.getBaseInfo()
  146. }
  147. this.pageList()
  148. },
  149. methods: {
  150. toRecord() {
  151. uni.navigateTo({
  152. url: '/packageOperate/lottery/record'
  153. })
  154. },
  155. toGroup(){
  156. uni.navigateTo({
  157. url: "/packageOperate/lottery/details"
  158. })
  159. },
  160. changeTab(e) {
  161. if (e.index == 0) {
  162. this.triggerStatus = 0
  163. this.status = 'nomore'
  164. } else if (e.index == 1) {
  165. this.triggerStatus = 1
  166. this.status = 'nomore'
  167. }
  168. this.pageList()
  169. },
  170. pageList() {
  171. this.pageNum = 1
  172. this.total = 0
  173. this.list = []
  174. this.getList()
  175. },
  176. getList() {
  177. this.loading = true
  178. $http.post(`/api/v1/mp/user/marketing/list?pageNum=${this.pageNum}&pageSize=5`, {
  179. triggerStatus: this.triggerStatus,
  180. }).then(res => {
  181. this.loading = false
  182. if (res.code == 0) {
  183. res.rows.forEach(item => {
  184. let picUrlArr = item.picUrl.split(',')
  185. item.picUrl = env.filePublic + picUrlArr[0] + '?imageView2/2/w/750'
  186. item.status = JSON.parse(item.status)
  187. })
  188. this.total = res.total
  189. this.list = this.list.concat(res.rows)
  190. }
  191. }).catch(() => {
  192. this.loading = false
  193. })
  194. },
  195. getBaseInfo() {
  196. $http.post('/api/v1/mp/user/getLoginUserinfo', { appSource: appId }).then(res => {
  197. uni.hideLoading();
  198. if (res.code == 0) {
  199. this.userInfo = res.data
  200. }
  201. })
  202. },
  203. },
  204. //分享好友
  205. onShareAppMessage(res) {
  206. return {
  207. title: '盲票,玩的就是有趣',
  208. path: '/pages/index/index'
  209. }
  210. },
  211. //分享朋友圈
  212. onShareTimeline() {
  213. return {
  214. title: '盲票,玩的就是有趣',
  215. query: `userId=${ this.userInfo.userId?this.userInfo.userId:null }&type=1`
  216. }
  217. },
  218. onReachBottom() {
  219. if(this.total < this.pageNum * 5) return ;
  220. this.status = 'loading';
  221. ++this.pageNum
  222. if(this.total < this.pageNum * 5) this.status = 'nomore';
  223. else this.status = 'loading';
  224. this.getList()
  225. },
  226. }
  227. </script>
  228. <style lang="scss" scoped>
  229. .activity {
  230. width: 100%;
  231. height: 100%;
  232. // 设置ios刘海屏底部横线安全区域
  233. padding-bottom: constant(safe-area-inset-bottom);
  234. padding-bottom: env(safe-area-inset-bottom);
  235. }
  236. .lottery-inner{
  237. width: 700rpx;
  238. margin: auto;
  239. background: #fff;
  240. overflow: hidden;
  241. margin-bottom: 20rpx;
  242. border-radius: 10rpx;
  243. .lottery-img{
  244. width: 200rpx;
  245. float: left;
  246. padding: 5rpx;
  247. image{
  248. width: 100%;
  249. height: 220rpx;
  250. }
  251. }
  252. .lottery-msg{
  253. margin-left: 220rpx;
  254. padding: 15rpx 0rpx;
  255. position: relative;
  256. .lottery-title{
  257. font-size: 30rpx;
  258. color: #000000;
  259. font-weight: 500;
  260. margin-bottom: 10rpx;
  261. }
  262. .lottery-time{
  263. font-size: 28rpx;
  264. color: #666666;
  265. margin-bottom: 5rpx;
  266. }
  267. .lottery-person{
  268. font-size: 28rpx;
  269. color: #666666;
  270. margin-bottom: 20rpx;
  271. }
  272. .lottery-price{
  273. color: red;
  274. font-size: 34rpx;
  275. text{
  276. font-size: 24rpx;
  277. margin-right: 5rpx;
  278. }
  279. }
  280. .toGroup{
  281. width: 142rpx;
  282. height: 58rpx;
  283. line-height: 58rpx;
  284. background-color: #8E51F7;
  285. color: #fff;
  286. margin-top: 34rpx;
  287. font-size: 28rpx;
  288. border-radius: 8rpx;
  289. display: block;
  290. text-align: center;
  291. position: absolute;
  292. right: 20rpx;
  293. bottom: 20rpx;
  294. }
  295. .toGroup1{
  296. width: 142rpx;
  297. height: 58rpx;
  298. line-height: 58rpx;
  299. background-color: #8E51F7;
  300. color: #fff;
  301. margin-top: 34rpx;
  302. font-size: 28rpx;
  303. border-radius: 8rpx;
  304. display: block;
  305. text-align: center;
  306. }
  307. .toGroup1.notactive{
  308. background-color: #9E9E9E;
  309. }
  310. }
  311. }
  312. .status {
  313. width: 100%;
  314. position: fixed;
  315. z-index: 100;
  316. background-color: #FFFFFF;
  317. box-shadow: 0 5rpx 5rpx #ececec;
  318. }
  319. .list {
  320. padding: 120rpx 20rpx 0;
  321. }
  322. .empty {
  323. height: 60vh;
  324. .center {
  325. text-align: center;
  326. &-img {
  327. width: 228rpx;
  328. height: 320rpx;
  329. }
  330. &-font {
  331. font-size: 30rpx;
  332. font-weight: 400;
  333. color: #999999;
  334. margin-bottom: 250rpx;
  335. }
  336. }
  337. }
  338. .price{
  339. float: right;
  340. color: red;
  341. font-size: 40rpx;
  342. }
  343. </style>