推拿小程序前端代码仓库
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.

504 lines
12 KiB

3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
  1. <template>
  2. <view class="page">
  3. <view class="flex flex-column header">
  4. <!-- 未登录显示 -->
  5. <view v-if="!isLogin" class="flex flex-column no-login">
  6. <view class="no-login-text">登录后查看个人信息</view>
  7. <button class="no-login-btn" @click="$utils.toLogin">立即登录</button>
  8. </view>
  9. <!-- 登录后显示用户信息 -->
  10. <view v-else class="flex flex-column user">
  11. <image class="user-avatar" :src="userInfo.headImage" mode="aspectFill"></image>
  12. <view class="user-name">{{ userInfo.nickName }}</view>
  13. </view>
  14. <view class="member">
  15. <view class="flex member-overview" :class="[role ? 'is-member' : '']">
  16. <template v-if="role">
  17. <!-- todo: 缺切图 "皇冠" -->
  18. <image class="icon icon-crown" src="" mode="widthFix"></image>
  19. <template v-if="role === 'member-personal'">
  20. <image class="icon icon-role" src="@/static/image/center/icon-member-personal.png" mode="widthFix"></image>
  21. </template>
  22. <template v-else-if="role === 'member-business'">
  23. <image class="icon icon-role" src="@/static/image/center/icon-member-business.png" mode="widthFix"></image>
  24. </template>
  25. <!-- todo: 换回接口字段 -->
  26. <text class="member-tips">{{ `将于${'2026-12-12'} 到期` }}</text>
  27. </template>
  28. <template v-else>
  29. <view class="flex">
  30. <!-- todo: 缺切图 "皇冠" -->
  31. <image class="icon icon-crown" src="" mode="widthFix"></image>
  32. <!-- todo: 缺切图 "会员" -->
  33. <image class="icon icon-member" src="" mode="widthFix"></image>
  34. <text class="member-tips">成为会员可获得会员卡享受会员福利哟~</text>
  35. </view>
  36. <button plain class="btn member-btn" @click="$utils.navigateTo('/pages_order/mine/memberCenter')">立即开通</button>
  37. </template>
  38. </view>
  39. <view class="member-rights">
  40. <image class="member-rights-bg" src="@/pages_order/static/center/member-bg.png" mode="top" ></image>
  41. <view class="flex member-rights-content">
  42. <view class="flex">
  43. <image class="icon icon-rights" src="@/static/image/center/icon-member-weal.png" mode="widthFix"></image>
  44. <view>
  45. <view class="member-rights-label">会员福利</view>
  46. <view class="member-rights-value">会员折扣</view>
  47. </view>
  48. </view>
  49. <view class="flex">
  50. <!-- todo: 缺切图 -->
  51. <image class="icon icon-rights" src="@/static/image/center/icon-member-weal.png" mode="widthFix"></image>
  52. <view>
  53. <view class="member-rights-label">会员积分</view>
  54. <view class="member-rights-value">兑换礼品</view>
  55. </view>
  56. </view>
  57. <!-- todo: 缺切图 -->
  58. <view class="flex">
  59. <image class="icon icon-rights" src="@/static/image/center/icon-member-weal.png" mode="widthFix"></image>
  60. <view>
  61. <view class="member-rights-label">会员优惠券</view>
  62. <view class="member-rights-value">满减折扣</view>
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. <!-- 账户信息 - 登录后显示 -->
  70. <view class="card flex account">
  71. <view class="flex flex-column">
  72. <view class="account-value">{{ riceInfo.balance || 0 }}<text class="account-unit"></text></view>
  73. <view class="account-label">我的余额</view>
  74. </view>
  75. <view class="flex flex-column">
  76. <!-- todo: 字段对接 -->
  77. <view class="account-value">{{ riceInfo.balance || 0 }}</view>
  78. <view class="account-label">我的积分</view>
  79. </view>
  80. <view class="flex flex-column">
  81. <view class="account-value">{{ riceInfo.canWithdraw || 0 }}<text class="account-unit"></text></view>
  82. <view class="account-label">推广佣金</view>
  83. </view>
  84. <view class="flex flex-column">
  85. <!-- todo: 字段对接 -->
  86. <view class="account-value">{{ riceInfo.balance || 0 }}<text class="account-unit"></text></view>
  87. <view class="account-label">优惠券</view>
  88. </view>
  89. </view>
  90. <view class="card fun-common">
  91. <view v-if="isMerchants" class="fun-header">
  92. <cardTitle>常用功能</cardTitle>
  93. </view>
  94. <view class="fun-content fun-common-content">
  95. <view class="flex flex-column" @click="$utils.navigateTo('/pages_order/mine/memberCenter')">
  96. <image class="fun-common-icon" src="@/static/image/center/icon-member-center.png" mode="widthFix"></image>
  97. <text class="fun-common-label">会员中心</text>
  98. </view>
  99. <view class="flex flex-column" @click="$utils.navigateTo('/pages_order/mine/partner')">
  100. <image class="fun-common-icon" src="@/static/image/center/icon-team.png" mode="widthFix"></image>
  101. <text class="fun-common-label">我的团队</text>
  102. </view>
  103. <view class="flex flex-column" @click="$utils.navigateTo('/pages_order/mine/promotion')">
  104. <image class="fun-common-icon" src="@/static/image/center/icon-invite.png" mode="widthFix"></image>
  105. <text class="fun-common-label">邀请好友</text>
  106. </view>
  107. <view class="flex flex-column" @click="$utils.navigateTo('/pages_order/mine/coupon')">
  108. <image class="fun-common-icon" src="@/static/image/center/icon-coupon.png" mode="widthFix"></image>
  109. <text class="fun-common-label">优惠券</text>
  110. </view>
  111. <view class="flex flex-column" @click="$utils.navigateTo('/pages_order/mine/voucher')">
  112. <image class="fun-common-icon" src="@/static/image/center/icon-voucher.png" mode="widthFix"></image>
  113. <text class="fun-common-label">代金券</text>
  114. </view>
  115. <!-- todo: check -> @click="openServicePopup" -->
  116. <view class="flex flex-column" @click="$utils.navigateTo('/pages_order/home/contact')">
  117. <image class="fun-common-icon" src="@/static/image/center/icon-service.png" mode="widthFix"></image>
  118. <text class="fun-common-label">联系客服</text>
  119. </view>
  120. <view class="flex flex-column" @click="$utils.navigateTo('/pages_order/mine/signIn')">
  121. <image class="fun-common-icon" src="@/static/image/center/icon-sign-in.png" mode="widthFix"></image>
  122. <text class="fun-common-label">每日签到</text>
  123. </view>
  124. <view class="flex flex-column" @click="$utils.navigateTo('/pages_order/mine/cooperation')">
  125. <image class="fun-common-icon" src="@/static/image/center/icon-cooperation.png" mode="widthFix"></image>
  126. <text class="fun-common-label">商家合作</text>
  127. </view>
  128. </view>
  129. </view>
  130. <view v-if="isMerchants" class="card fun-merchant">
  131. <view class="fun-header">
  132. <cardTitle>商家功能</cardTitle>
  133. </view>
  134. <view class="flex fun-content fun-merchant-content">
  135. <view class="left" @click="$utils.navigateTo('/pages_order/mine/verifyRecord')">
  136. <image class="left-bg" src="@/static/image/center/bg-verify.png"></image>
  137. <view class="flex left-content">
  138. <text>核销明细</text>
  139. <image class="left-icon" src="@/static/image/center/icon-arrow.png" mode="widthFix"></image>
  140. </view>
  141. </view>
  142. <!-- todo -->
  143. <view class="right" @click="onScan">
  144. <image class="right-bg" src="@/static/image/center/bg-scan.png"></image>
  145. </view>
  146. </view>
  147. </view>
  148. <customerServicePopup ref="customerServicePopup" />
  149. <tabber select="center" />
  150. </view>
  151. </template>
  152. <script>
  153. import cardTitle from '@/components/base/cardTitle.vue'
  154. import tabber from '@/components/base/tabbar.vue'
  155. import { mapGetters, mapState } from 'vuex'
  156. import customerServicePopup from '@/components/config/customerServicePopup.vue'
  157. export default {
  158. components: {
  159. cardTitle,
  160. tabber,
  161. customerServicePopup,
  162. },
  163. computed: {
  164. ...mapGetters(['role']),
  165. ...mapState(['userInfo', 'riceInfo']),
  166. isMerchants() {
  167. return this.userInfo.isMerchants === '1'
  168. },
  169. isLogin() {
  170. return this.userInfo && this.userInfo.id
  171. }
  172. },
  173. data() {
  174. return {
  175. }
  176. },
  177. onShow() {
  178. if(this.isLogin){
  179. this.$store.commit('getUserInfo')
  180. this.$store.commit('getRiceInfo')
  181. }
  182. },
  183. methods: {
  184. clickNo() {
  185. uni.showModal({
  186. title: '暂未开放',
  187. })
  188. },
  189. logout(){
  190. uni.showModal({
  191. title: '确认退出登录吗',
  192. success : (r) => {
  193. if (r.confirm) {
  194. this.$store.commit('logout', true)
  195. }
  196. }
  197. })
  198. },
  199. openServicePopup(phone, title) {
  200. // todo
  201. this.$refs.customerServicePopup.open(phone, title)
  202. },
  203. onScan() {
  204. // todo check
  205. uni.scanCode({
  206. success: (res) => {
  207. console.log(res);
  208. if (res.result) {
  209. // 处理扫码结果
  210. console.log('扫码结果:', res.result);
  211. this.$fetch('overOrder', {
  212. orderId : res.result
  213. }).then(() => {
  214. uni.showToast({
  215. title: '核销成功',
  216. icon: 'none'
  217. })
  218. })
  219. }
  220. },
  221. fail: (err) => {
  222. console.error('扫码失败:', err);
  223. uni.showToast({
  224. title: '扫码失败',
  225. icon: 'none'
  226. })
  227. }
  228. });
  229. },
  230. }
  231. }
  232. </script>
  233. <style scoped lang="scss">
  234. .page {
  235. background-color: #F5F5F5;
  236. .header {
  237. height: 550rpx;
  238. background-image: linear-gradient(#84A73F, #D8FF8F);
  239. justify-content: flex-start;
  240. position: relative;
  241. }
  242. }
  243. .user {
  244. margin-top: 123rpx;
  245. &-avatar {
  246. width: 115rpx;
  247. height: 115rpx;
  248. border-radius: 50%;
  249. }
  250. &-name {
  251. margin-top: 4rpx;
  252. color: $uni-text-color-inverse;
  253. font-size: 30rpx;
  254. text-align: center;
  255. }
  256. }
  257. .no-login {
  258. margin-top: 123rpx;
  259. align-items: center;
  260. &-img {
  261. width: 115rpx;
  262. height: auto;
  263. margin-bottom: 20rpx;
  264. }
  265. &-text {
  266. color: #FFFFFF;
  267. font-size: 28rpx;
  268. margin-bottom: 40rpx;
  269. }
  270. &-btn {
  271. padding: 16rpx 60rpx;
  272. background-color: #FFFFFF;
  273. color: #84A73F;
  274. font-size: 28rpx;
  275. font-weight: bold;
  276. border-radius: 40rpx;
  277. box-shadow: 0 4rpx 8rpx rgba(0, 0, 0, 0.1);
  278. }
  279. }
  280. .member {
  281. width: calc(100vw - 13rpx*2);
  282. position: absolute;
  283. bottom: 0;
  284. left: 13rpx;
  285. color: #F5F5F5;
  286. font-size: 22rpx;
  287. background-color: #2B2C30;
  288. border-top-left-radius: 20rpx;
  289. border-top-right-radius: 20rpx;
  290. &-overview {
  291. min-height: 81rpx;
  292. justify-content: space-between;
  293. &.is-member {
  294. justify-content: flex-start;
  295. }
  296. }
  297. .icon {
  298. height: auto;
  299. &-crown {
  300. width: 35rpx;
  301. margin-left: 20rpx;
  302. }
  303. &-member {
  304. width: 62rpx;
  305. }
  306. &-role {
  307. width: 156rpx;
  308. margin-right: 15rpx;
  309. }
  310. &-rights {
  311. width: 56rpx;
  312. margin-right: 11rpx;
  313. }
  314. }
  315. &-btn {
  316. padding: 9rpx 17rpx;
  317. color: #000000;
  318. font-size: 22rpx;
  319. background-image: linear-gradient(131deg, #F8EDE1, #B3997E);
  320. box-shadow: 0rpx 3rpx 6rpx 0rpx rgba(0,0,0,0.16);
  321. border-radius: 24rpx;
  322. margin-right: 18rpx;
  323. }
  324. &-tips {
  325. margin-left: 6rpx;
  326. }
  327. &-rights {
  328. background-color: #37393D;
  329. position: relative;
  330. width: 100%;
  331. height: 142rpx;
  332. box-sizing: border-box;
  333. &-bg {
  334. width: 100%;
  335. height: 100%;
  336. }
  337. &-content {
  338. position: absolute;
  339. bottom: 0;
  340. width: 100%;
  341. height: 100%;
  342. box-sizing: border-box;
  343. padding: 0 35rpx 6rpx 35rpx;
  344. justify-content: space-between;
  345. }
  346. &-label {
  347. color: #CBAD8F;
  348. font-size: 22rpx;
  349. font-weight: 700;
  350. }
  351. &-value {
  352. color: #F5F5F5;
  353. font-size: 18rpx;
  354. }
  355. }
  356. }
  357. .card {
  358. margin: 20rpx 13rpx 0 13rpx;
  359. }
  360. .account {
  361. padding: 40rpx 40rpx 23rpx 40rpx;
  362. justify-content: space-between;
  363. &-label {
  364. color: #666666;
  365. font-size: 28rpx;
  366. margin-top: 9rpx;
  367. }
  368. &-value {
  369. color: #000000;
  370. font-size: 32rpx;
  371. }
  372. &-unit {
  373. color: #666666;
  374. font-size: 18rpx;
  375. margin-left: 2rpx;
  376. }
  377. }
  378. .fun {
  379. &-header {
  380. text-align: left;
  381. padding-left: 12rpx;
  382. margin-bottom: 19rpx;
  383. /deep/ .title__view {
  384. display: inline-flex;
  385. }
  386. }
  387. &-content {
  388. margin-top: 24rpx;
  389. }
  390. &-common {
  391. padding: 30rpx 40rpx 67rpx 40rpx;
  392. &-content {
  393. display: grid;
  394. grid-template-columns: repeat(4, 1fr);
  395. grid-column-gap: 71rpx;
  396. grid-row-gap: 81rpx;
  397. }
  398. &-icon {
  399. width: 66rpx;
  400. height: auto;
  401. }
  402. &-label {
  403. color: #000000;
  404. font-size: 28rpx;
  405. margin-top: 5rpx;
  406. }
  407. }
  408. &-merchant {
  409. padding: 33rpx 30rpx 28rpx 30rpx;
  410. margin-bottom: 10rpx;
  411. &-content {
  412. justify-content: space-between;
  413. }
  414. .left {
  415. width: 198rpx;
  416. height: 139rpx;
  417. position: relative;
  418. &-bg {
  419. width: 100%;
  420. height: 100%;
  421. }
  422. &-content {
  423. position: absolute;
  424. top: 13rpx;
  425. left: 14rpx;
  426. color: $uni-text-color-inverse;
  427. font-size: 28rpx;
  428. }
  429. &-icon {
  430. width: 23rpx;
  431. height: auto;
  432. margin-left: 9rpx;
  433. }
  434. }
  435. .right {
  436. width: 429rpx;
  437. height: 164rpx;
  438. margin-top: -25rpx;
  439. &-bg {
  440. width: 100%;
  441. height: 100%;
  442. }
  443. }
  444. }
  445. }
  446. </style>