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

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