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

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