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

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