四零语境前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

480 lines
12 KiB

1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
  1. <template>
  2. <view class="promote-page">
  3. <uv-status-bar></uv-status-bar>
  4. <!-- 主要内容区域 -->
  5. <view class="content">
  6. <!-- 推广官图片 -->
  7. <view class="promote-image-container">
  8. <uv-icon name="arrow-left" size="20" color="black" @click="goBack"></uv-icon>
  9. <view :style="{flex: 1, justifyContent: 'center', display: 'flex'}">
  10. <image
  11. class="promote-image"
  12. src="/static/推广官.png"
  13. mode="widthFix"
  14. ></image>
  15. </view>
  16. </view>
  17. <!-- 推广标语图片 -->
  18. <view class="slogan-container">
  19. <image
  20. class="slogan-image"
  21. src="/static/推广标语.png"
  22. mode="widthFix"
  23. ></image>
  24. </view>
  25. </view>
  26. <!-- 外部大容器 -->
  27. <view class="main-container">
  28. <!-- 个人信息容器 -->
  29. <view class="profile-container">
  30. <image class="profile-avatar" :src="userInfo.avatar" mode="aspectFill"></image>
  31. <view class="profile-info">
  32. <text class="profile-name">{{ userInfo.name }}</text>
  33. <!-- <text class="profile-id">ID: {{ userInfo.id }}</text> -->
  34. </view>
  35. <view class="profile-stats">
  36. <view class="stat-item">
  37. <text class="stat-number">{{ num }}</text>
  38. <text class="stat-label">推广人数</text>
  39. </view>
  40. <view class="stat-item">
  41. <text class="stat-number">{{ userInfo.commission }}</text>
  42. <text class="stat-label">总佣金</text>
  43. </view>
  44. </view>
  45. </view>
  46. <!-- 功能按钮区域 -->
  47. <view class="function-buttons">
  48. <view class="function-item" @click="goTeam">
  49. <image class="function-icon" src="/static/团队图标.png" mode="aspectFit"></image>
  50. <text class="function-text">我的团队</text>
  51. </view>
  52. <view class="function-item" @click="goQrcode">
  53. <image class="function-icon" src="/static/二维码图标.png" mode="aspectFit"></image>
  54. <text class="function-text">我的二维码</text>
  55. </view>
  56. <view class="function-item" @click="goCash">
  57. <image class="function-icon" src="/static/提现图标.png" mode="aspectFit"></image>
  58. <text class="function-text">提现</text>
  59. </view>
  60. </view>
  61. <!-- 余额显示 -->
  62. <view class="balance-section">
  63. <text class="balance-label">余额</text>
  64. <text class="balance-amount">¥{{ userInfo.price || 0 }}</text>
  65. <uv-icon name="arrow-right" size="16" color="#999"></uv-icon>
  66. </view>
  67. <!-- 转账记录容器 -->
  68. <view class="record-container">
  69. <view class="record-list">
  70. <view class="record-item" v-for="(item, index) in list" :key="index">
  71. <view class="record-avatar">
  72. <image class="avatar" :src="item.userInfo.avatar" mode="aspectFill"></image>
  73. <text class="avatar-name">{{ item.user_dictText }}</text>
  74. </view>
  75. <view class="record-info">
  76. <text class="record-title">{{ item.title }}</text>
  77. <text class="record-date">{{ item.createTime }}</text>
  78. </view>
  79. <view class="record-amount">
  80. <text class="amount">+{{ item.money }}</text>
  81. <text class="status"
  82. :class="item.withdrawal.status === '1'
  83. && item.withdrawal.withdrawStatus === '0' ? 'status-available' : 'status-received'"
  84. v-if="item.withdrawal && item.withdrawal.status != '1'">{{ getText(item.withdrawal) }}</text>
  85. </view>
  86. </view>
  87. </view>
  88. </view>
  89. </view>
  90. <!-- 底部固定按钮 -->
  91. <view class="bottom-button-container">
  92. <uv-button :custom-style="{
  93. height: '82rpx',
  94. borderRadius: '198rpx',
  95. background: '#06DADC',
  96. border: '2rpx solid #06DADC',
  97. lineHeight: '82rpx',
  98. fontSize: '36rpx'
  99. }" type="primary" @click="goQrcode">分享</uv-button>
  100. <uv-safe-bottom></uv-safe-bottom>
  101. </view>
  102. </view>
  103. </template>
  104. <script>
  105. import MixinList from '@/mixins/list'
  106. export default {
  107. mixins: [MixinList],
  108. data() {
  109. return {
  110. mixinListApi: 'promotion.water',
  111. num: 0,
  112. userInfo: {},
  113. }
  114. },
  115. methods: {
  116. goBack() {
  117. uni.navigateBack()
  118. },
  119. goTeam() {
  120. uni.navigateTo({
  121. url: '/subPages/user/team'
  122. })
  123. },
  124. goCash() {
  125. uni.navigateTo({
  126. url: '/subPages/user/cash'
  127. })
  128. },
  129. getText(widhdraw) {
  130. // 如果已经领取了
  131. if (widhdraw.withdrawStatus !== '0') {
  132. return '已领取,' + (widhdraw.method === '0' ? '微信打款' : '线下付款')
  133. }else if (widhdraw.status === '0') {
  134. return '提现待审核中'
  135. }else if(widhdraw.status === '2'){
  136. return '审核失败!'
  137. }
  138. },
  139. // 获取推广统计
  140. async getStatistics() {
  141. const res = await this.$api.promotion.statistics()
  142. if (res.code === 200) {
  143. this.num = res.result.num
  144. }
  145. },
  146. // 获取用户信息
  147. async getUserInfo() {
  148. const res = await this.$api.login.getUserInfo()
  149. if (res.code === 200) {
  150. this.userInfo = res.result
  151. }
  152. },
  153. requestMerchantTransfer(item) {
  154. if (!wx.canIUse('requestMerchantTransfer')) {
  155. wx.showModal({
  156. content: '你的微信版本过低,请更新至最新版本。',
  157. showCancel: false,
  158. });
  159. return
  160. }
  161. wx.requestMerchantTransfer({
  162. mchId: '1673516176',//万能墙商户号
  163. appId: wx.getAccountInfoSync().miniProgram.appId,
  164. package: item.packageInfo,
  165. success: (res) => {
  166. // res.err_msg将在页面展示成功后返回应用时返回ok,并不代表提款成功
  167. console.log('success:', res);
  168. this.getData()
  169. this.$api('requestMerchantTransfer', {
  170. id : item.id,
  171. })
  172. },
  173. fail: (res) => {
  174. console.log('fail:', res);
  175. this.getData()
  176. },
  177. });
  178. },
  179. // 去二维码
  180. goQrcode() {
  181. uni.navigateTo({
  182. url: '/subPages/user/share'
  183. })
  184. },
  185. },
  186. async onShow() {
  187. Promise.all([
  188. this.getUserInfo(),
  189. this.getStatistics()
  190. ])
  191. },
  192. }
  193. </script>
  194. <style lang="scss" scoped>
  195. .promote-page {
  196. min-height: 100vh;
  197. background: linear-gradient(124deg, #22F2EB 0%, #24B0F6 30%);
  198. // background: linear-gradient(124deg, #22F2EB 0%, #24B0F6 100%);
  199. }
  200. .content {
  201. padding: 0rpx 40rpx 0;
  202. .promote-image-container {
  203. display: flex;
  204. justify-content: center;
  205. margin-bottom: 30rpx;
  206. align-items: center;
  207. .promote-image {
  208. margin: 0 auto;
  209. width: 168rpx;
  210. }
  211. }
  212. .slogan-container {
  213. display: flex;
  214. justify-content: center;
  215. margin-bottom: 80rpx;
  216. .slogan-image {
  217. width: 670rpx;
  218. }
  219. }
  220. }
  221. // 外部大容器
  222. .main-container {
  223. width: 100%;
  224. border-radius: 48rpx;
  225. border: 2rpx solid #06DADC12;
  226. box-sizing: border-box;
  227. padding: 40rpx;
  228. padding-bottom: 200rpx;
  229. background: linear-gradient(180deg, #DEFFFF 0%, #FBFEFF 22.65%, #F0FBFF 100%);
  230. // 个人信息容器
  231. .profile-container {
  232. background: #fff;
  233. margin-bottom: 30rpx;
  234. display: flex;
  235. align-items: center;
  236. border-radius: 48rpx;
  237. border-width: 2rpx;
  238. justify-content: space-between;
  239. background: linear-gradient(180deg, #DEFFFF 0%, #FBFEFF 22.65%, #F0FBFF 100%);
  240. // background: red;
  241. border: 2rpx solid #06DADC12;
  242. // padding-top: 32rpx;
  243. padding-right: 40rpx;
  244. // padding-bottom: 32rpx;
  245. // padding-left: 40rpx;
  246. height: 200rpx;
  247. .profile-avatar {
  248. width: 128rpx;
  249. height: 128rpx;
  250. border-radius: 50%;
  251. margin-right: 24rpx;
  252. }
  253. .profile-info {
  254. flex: 1;
  255. .profile-name {
  256. display: block;
  257. font-size: 32rpx;
  258. font-weight: 600;
  259. color: #333;
  260. margin-bottom: 8rpx;
  261. }
  262. .profile-id {
  263. font-size: 24rpx;
  264. color: #999;
  265. }
  266. }
  267. .profile-stats {
  268. display: flex;
  269. .stat-item {
  270. text-align: center;
  271. margin-left: 100rpx;
  272. .stat-number {
  273. display: block;
  274. font-size: 32rpx;
  275. font-weight: bold;
  276. color: #333;
  277. margin-bottom: 8rpx;
  278. }
  279. .stat-label {
  280. font-size: 24rpx;
  281. color: #999;
  282. }
  283. }
  284. }
  285. }
  286. // 功能按钮区域
  287. .function-buttons {
  288. display: flex;
  289. justify-content: space-around;
  290. align-items: center;
  291. margin-bottom: 48rpx;
  292. .function-item {
  293. display: flex;
  294. // flex-direction: column;
  295. align-items: center;
  296. gap: 16rpx;
  297. border-right: 1px solid #06DADC;
  298. padding-right: 30rpx;
  299. &:nth-child(3) {
  300. border-right: none;
  301. }
  302. .function-icon {
  303. width: 46rpx;
  304. height: 46rpx;
  305. // margin-bottom: 16rpx;
  306. }
  307. .function-text {
  308. font-size: 24rpx;
  309. color: #181818;
  310. }
  311. }
  312. }
  313. // 余额显示
  314. .balance-section {
  315. display: flex;
  316. align-items: center;
  317. justify-content: space-between;
  318. margin-bottom: 40rpx;
  319. .balance-label {
  320. font-size: 32rpx;
  321. color: #191919;
  322. font-weight: 500;
  323. }
  324. .balance-amount {
  325. font-size: 32rpx;
  326. font-weight: 500;
  327. color: #191919;
  328. flex: 1;
  329. margin-left: 20rpx;
  330. }
  331. }
  332. // 转账记录容器
  333. .record-container {
  334. .record-list {
  335. border: 1px solid #F0F0F0;
  336. border-radius: 24rpx;
  337. // background: red;
  338. .record-item {
  339. height: 116rpx;
  340. background: #fff;
  341. // border-radius: 16rpx;
  342. padding: 16rpx 32rpx;
  343. // margin-bottom: 20rpx;
  344. display: flex;
  345. align-items: center;
  346. border-bottom: 2rpx solid #F1F1F1 ;
  347. // margin-right: 24rpx;
  348. // box-sizing: border-box;
  349. .record-avatar{
  350. display: flex;
  351. align-items: center;
  352. flex-direction: column;
  353. gap: 12rpx;
  354. .avatar-name {
  355. font-size: 24rpx;
  356. color: #999;
  357. }
  358. .avatar {
  359. width: 50rpx;
  360. height: 50rpx;
  361. border-radius: 50%;
  362. // margin-right: 24rpx;
  363. }
  364. }
  365. .record-info {
  366. flex: 3;
  367. text-align: center;
  368. .record-title {
  369. display: block;
  370. font-size: 28rpx;
  371. color: #333;
  372. margin-bottom: 8rpx;
  373. }
  374. .record-date {
  375. font-size: 26rpx;
  376. color: #A3A3A3;
  377. }
  378. }
  379. .record-amount {
  380. flex: 2;
  381. text-align: center;
  382. .amount {
  383. display: block;
  384. font-size: 28rpx;
  385. font-weight: bold;
  386. color: #333;
  387. margin-bottom: 8rpx;
  388. }
  389. .status {
  390. font-size: 26rpx;
  391. // padding: 8rpx 16rpx;
  392. border-radius: 20rpx;
  393. &.status-received {
  394. // background: #f0f0f0;
  395. color: #A3A3A3;
  396. }
  397. &.status-available {
  398. // background: #22F2EB;
  399. padding: 3rpx 16rpx;
  400. color: $primary-color;
  401. border: 2rpx solid $primary-color;
  402. }
  403. }
  404. }
  405. }
  406. }
  407. }
  408. }
  409. // 底部固定按钮
  410. .bottom-button-container {
  411. position: fixed;
  412. bottom: 0;
  413. left: 0;
  414. right: 0;
  415. padding: 30rpx 40rpx;
  416. background: rgba(255, 255, 255, 0.95);
  417. border-top: 1px solid #F1F1F1;
  418. // height: 143rpx;
  419. // backdrop-filter: blur(10rpx);
  420. }
  421. </style>