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

522 lines
13 KiB

4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 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. <view class="account-value">{{ userCenterData.score || 0 }}</view>
  71. <view class="account-label">我的积分</view>
  72. </view>
  73. <view class="flex flex-column">
  74. <view class="account-value">{{ userInfo.recommendAmount || 0 }}<text class="account-unit"></text></view>
  75. <view class="account-label">推广佣金</view>
  76. </view>
  77. <view class="flex flex-column">
  78. <view class="account-value">{{ couponCount || 0 }}<text class="account-unit"></text></view>
  79. <view class="account-label">优惠券</view>
  80. </view>
  81. </view>
  82. <view class="card fun-common">
  83. <view v-if="isMerchants" class="fun-header">
  84. <cardTitle>常用功能</cardTitle>
  85. </view>
  86. <view class="fun-content fun-common-content">
  87. <view class="flex flex-column" @click="$utils.navigateTo('/pages_order/mine/memberCenter')">
  88. <image class="fun-common-icon" src="@/static/image/center/icon-member-center.png" mode="widthFix"></image>
  89. <text class="fun-common-label">会员中心</text>
  90. </view>
  91. <view class="flex flex-column" @click="$utils.navigateTo('/pages_order/mine/partner')">
  92. <image class="fun-common-icon" src="@/static/image/center/icon-team.png" mode="widthFix"></image>
  93. <text class="fun-common-label">我的团队</text>
  94. </view>
  95. <!-- #ifdef MP-WEIXIN -->
  96. <view class="flex flex-column" @click="$utils.navigateTo('/pages_order/mine/promotion')">
  97. <!-- #endif -->
  98. <!-- #ifdef H5 -->
  99. <view class="flex flex-column" @click="$utils.navigateTo('/pages_order/mine/promotionH5')">
  100. <!-- #endif -->
  101. <image class="fun-common-icon" src="@/static/image/center/icon-invite.png" mode="widthFix"></image>
  102. <text class="fun-common-label">邀请好友</text>
  103. </view>
  104. <view class="flex flex-column" @click="$utils.navigateTo('/pages_order/mine/coupon')">
  105. <image class="fun-common-icon" src="@/static/image/center/icon-coupon.png" mode="widthFix"></image>
  106. <text class="fun-common-label">优惠券</text>
  107. </view>
  108. <view class="flex flex-column" @click="$utils.navigateTo('/pages_order/mine/voucher')">
  109. <image class="fun-common-icon" src="@/static/image/center/icon-voucher.png" mode="widthFix"></image>
  110. <text class="fun-common-label">代金券</text>
  111. </view>
  112. <!-- todo: check -> @click="openServicePopup" -->
  113. <view class="flex flex-column" @click="$utils.navigateTo('/pages_order/home/contact')">
  114. <image class="fun-common-icon" src="@/static/image/center/icon-service.png" mode="widthFix"></image>
  115. <text class="fun-common-label">联系客服</text>
  116. </view>
  117. <view class="flex flex-column" @click="$utils.navigateTo('/pages_order/mine/signIn')">
  118. <image class="fun-common-icon" src="@/static/image/center/icon-sign-in.png" mode="widthFix"></image>
  119. <text class="fun-common-label">每日签到</text>
  120. </view>
  121. <view class="flex flex-column" @click="$utils.navigateTo('/pages_order/mine/cooperation')">
  122. <image class="fun-common-icon" src="@/static/image/center/icon-cooperation.png" mode="widthFix"></image>
  123. <text class="fun-common-label">商家合作</text>
  124. </view>
  125. </view>
  126. </view>
  127. <view v-if="isMerchants" class="card fun-merchant">
  128. <view class="fun-header">
  129. <cardTitle>商家功能</cardTitle>
  130. </view>
  131. <view class="flex fun-content fun-merchant-content">
  132. <view class="left" @click="$utils.navigateTo('/pages_order/mine/verifyRecord')">
  133. <image class="left-bg" src="@/static/image/center/bg-verify.png"></image>
  134. <view class="flex left-content">
  135. <text>核销明细</text>
  136. <image class="left-icon" src="@/static/image/center/icon-arrow.png" mode="widthFix"></image>
  137. </view>
  138. </view>
  139. <!-- todo -->
  140. <view class="right" @click="onScan">
  141. <image class="right-bg" src="@/static/image/center/bg-scan.png"></image>
  142. </view>
  143. </view>
  144. </view>
  145. <customerServicePopup ref="customerServicePopup" />
  146. <tabber select="center" />
  147. </view>
  148. </template>
  149. <script>
  150. import cardTitle from '@/components/base/cardTitle.vue'
  151. import tabber from '@/components/base/tabbar.vue'
  152. import { mapGetters, mapState } from 'vuex'
  153. import customerServicePopup from '@/components/config/customerServicePopup.vue'
  154. export default {
  155. components: {
  156. cardTitle,
  157. tabber,
  158. customerServicePopup,
  159. },
  160. computed: {
  161. ...mapGetters(['role']),
  162. ...mapState(['userInfo', 'userCenterData', 'vipInfo', 'riceInfo']),
  163. isMerchants() {
  164. return this.userInfo.isMerchants === '1'
  165. },
  166. isLogin() {
  167. return this.userInfo && this.userInfo.id
  168. }
  169. },
  170. data() {
  171. return {
  172. couponCount: 0,
  173. }
  174. },
  175. onShow() {
  176. if(uni.getStorageSync('token')){
  177. this.$store.commit('getUserInfo')
  178. this.$store.commit('getUserCenterInfo')
  179. this.$store.commit('getRiceInfo')
  180. this.fetchCouponData()
  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. const [id, type] = res.result.split(',')
  211. console.log('扫码结果:', res.result);
  212. console.log('--overOrder', {
  213. orderId : id,
  214. type, // type区分,0-订单核销 1-代金券核销
  215. })
  216. this.$fetch('overOrder', {
  217. orderId : id,
  218. type, // type区分,0-订单核销 1-代金券核销
  219. }).then(() => {
  220. uni.showToast({
  221. title: '核销成功',
  222. icon: 'none'
  223. })
  224. })
  225. }
  226. },
  227. fail: (err) => {
  228. console.error('扫码失败:', err);
  229. uni.showToast({
  230. title: '扫码失败',
  231. icon: 'none'
  232. })
  233. }
  234. });
  235. },
  236. async fetchCouponData() {
  237. try {
  238. const { total } = await this.$fetch('queryVouchersList', { type: 0 })
  239. this.couponCount = total
  240. } catch (err) {
  241. }
  242. },
  243. }
  244. }
  245. </script>
  246. <style scoped lang="scss">
  247. .page {
  248. background-color: #F5F5F5;
  249. .header {
  250. height: 550rpx;
  251. background-image: linear-gradient(#84A73F, #D8FF8F);
  252. justify-content: flex-start;
  253. position: relative;
  254. }
  255. }
  256. .user {
  257. margin-top: 123rpx;
  258. &-avatar {
  259. width: 115rpx;
  260. height: 115rpx;
  261. border-radius: 50%;
  262. }
  263. &-name {
  264. margin-top: 4rpx;
  265. color: $uni-text-color-inverse;
  266. font-size: 30rpx;
  267. text-align: center;
  268. }
  269. }
  270. .no-login {
  271. margin-top: 123rpx;
  272. align-items: center;
  273. &-img {
  274. width: 115rpx;
  275. height: auto;
  276. margin-bottom: 20rpx;
  277. }
  278. &-text {
  279. color: #FFFFFF;
  280. font-size: 28rpx;
  281. margin-bottom: 40rpx;
  282. }
  283. &-btn {
  284. padding: 16rpx 60rpx;
  285. background-color: #FFFFFF;
  286. color: #84A73F;
  287. font-size: 28rpx;
  288. font-weight: bold;
  289. border-radius: 40rpx;
  290. box-shadow: 0 4rpx 8rpx rgba(0, 0, 0, 0.1);
  291. }
  292. }
  293. .member {
  294. width: calc(724rpx);
  295. position: absolute;
  296. bottom: 0;
  297. left: 13rpx;
  298. color: #F5F5F5;
  299. font-size: 22rpx;
  300. background-color: #2B2C30;
  301. border-top-left-radius: 20rpx;
  302. border-top-right-radius: 20rpx;
  303. &-overview {
  304. min-height: 81rpx;
  305. justify-content: space-between;
  306. &.is-member {
  307. justify-content: flex-start;
  308. }
  309. }
  310. .icon {
  311. height: auto;
  312. &-crown {
  313. width: 35rpx;
  314. margin-left: 20rpx;
  315. }
  316. &-member {
  317. width: 62rpx;
  318. }
  319. &-role {
  320. width: 156rpx;
  321. margin-right: 15rpx;
  322. }
  323. &-rights {
  324. width: 56rpx;
  325. margin-right: 11rpx;
  326. }
  327. }
  328. &-btn {
  329. padding: 9rpx 17rpx;
  330. color: #000000;
  331. font-size: 22rpx;
  332. background-image: linear-gradient(131deg, #F8EDE1, #B3997E);
  333. box-shadow: 0rpx 3rpx 6rpx 0rpx rgba(0,0,0,0.16);
  334. border-radius: 24rpx;
  335. margin-right: 18rpx;
  336. }
  337. &-tips {
  338. margin-left: 6rpx;
  339. }
  340. &-rights {
  341. background-color: #37393D;
  342. position: relative;
  343. width: 100%;
  344. height: 142rpx;
  345. box-sizing: border-box;
  346. &-bg {
  347. width: 100%;
  348. height: 100%;
  349. }
  350. &-content {
  351. position: absolute;
  352. bottom: 0;
  353. width: 100%;
  354. height: 100%;
  355. box-sizing: border-box;
  356. padding: 0 35rpx 6rpx 35rpx;
  357. justify-content: space-between;
  358. }
  359. &-label {
  360. color: #CBAD8F;
  361. font-size: 22rpx;
  362. font-weight: 700;
  363. }
  364. &-value {
  365. color: #F5F5F5;
  366. font-size: 18rpx;
  367. }
  368. }
  369. }
  370. .card {
  371. margin: 20rpx 13rpx 0 13rpx;
  372. }
  373. .account {
  374. padding: 40rpx 40rpx 23rpx 40rpx;
  375. justify-content: space-between;
  376. &-label {
  377. color: #666666;
  378. font-size: 28rpx;
  379. margin-top: 9rpx;
  380. }
  381. &-value {
  382. color: #000000;
  383. font-size: 32rpx;
  384. }
  385. &-unit {
  386. color: #666666;
  387. font-size: 18rpx;
  388. margin-left: 2rpx;
  389. }
  390. }
  391. .fun {
  392. &-header {
  393. text-align: left;
  394. padding-left: 12rpx;
  395. margin-bottom: 19rpx;
  396. /deep/ .title__view {
  397. display: inline-flex;
  398. }
  399. }
  400. &-content {
  401. margin-top: 24rpx;
  402. }
  403. &-common {
  404. padding: 30rpx 40rpx 67rpx 40rpx;
  405. &-content {
  406. display: grid;
  407. grid-template-columns: repeat(4, 1fr);
  408. grid-column-gap: 71rpx;
  409. grid-row-gap: 81rpx;
  410. }
  411. &-icon {
  412. width: 66rpx;
  413. height: auto;
  414. }
  415. &-label {
  416. color: #000000;
  417. font-size: 28rpx;
  418. margin-top: 5rpx;
  419. }
  420. }
  421. &-merchant {
  422. padding: 33rpx 30rpx 28rpx 30rpx;
  423. margin-bottom: 10rpx;
  424. &-content {
  425. justify-content: space-between;
  426. }
  427. .left {
  428. width: 198rpx;
  429. height: 139rpx;
  430. position: relative;
  431. &-bg {
  432. width: 100%;
  433. height: 100%;
  434. }
  435. &-content {
  436. position: absolute;
  437. top: 13rpx;
  438. left: 14rpx;
  439. color: $uni-text-color-inverse;
  440. font-size: 28rpx;
  441. }
  442. &-icon {
  443. width: 23rpx;
  444. height: auto;
  445. margin-left: 9rpx;
  446. }
  447. }
  448. .right {
  449. width: 429rpx;
  450. height: 164rpx;
  451. margin-top: -25rpx;
  452. &-bg {
  453. width: 100%;
  454. height: 100%;
  455. }
  456. }
  457. }
  458. }
  459. </style>