四零语境前端代码仓库
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.

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