猫妈狗爸伴宠师小程序前端代码
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.

298 lines
8.1 KiB

3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
2 months ago
3 months ago
3 months ago
3 months ago
2 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
2 months ago
3 months ago
2 months ago
3 months ago
3 months ago
2 months ago
3 months ago
2 months ago
  1. <template>
  2. <view>
  3. <view class="user-header">
  4. <view class="flex flex-between login">
  5. <view style="width: 120rpx;">
  6. <up-image class="mr20" width="120rpx" height="120rpx" :src="userInfo.userImage"
  7. shape="circle"></up-image>
  8. </view>
  9. <view style="width: calc(100% - 120rpx); padding-left: 20rpx;box-sizing: border-box;">
  10. <view class="base-leavel">
  11. <text>{{getIsLogin()?userInfo.userName:"欢迎来到版宠师"}}</text>
  12. </view>
  13. <view>
  14. <image v-if="petMaster" class="role-tag" :src="petMaster" mode="aspectFill"></image>
  15. <image v-if="partnerMaster" class="role-tag" :src="partnerMaster" mode="aspectFill"></image>
  16. </view>
  17. <view>
  18. 手机号:{{ userInfo?.userTelephone }}
  19. </view>
  20. </view>
  21. <!-- <view style="width: 140rpx">
  22. <up-button v-else @click="logout" :customStyle="{borderColor:'#fff'}" type="primary" text="退出登录"
  23. shape="circle" color="#FFBF60"></up-button>
  24. </view> -->
  25. </view>
  26. <view class="header-money">
  27. <view class="header-money-list">
  28. <view class="header-money-item flex flex-evenly">
  29. <view style="text-align: center">
  30. <view class="mb20 flex">
  31. <up-image :show-loading="true" src="https://cdn.catmdogd.com/Work/image/work/icon4.png"
  32. width="68rpx" height="68rpx"></up-image>
  33. 服务酬劳
  34. </view>
  35. <view class="mb20">{{ userInfo.price }}</view>
  36. <view class="flex flex-between but">
  37. <view @click="toWithdrawDeposit">提现</view>
  38. <view>|</view>
  39. <view @click="toRunningWater">明细</view>
  40. </view>
  41. </view>
  42. <view style="text-align: center">
  43. <view class="mb20 flex">
  44. <up-image :show-loading="true" src="https://cdn.catmdogd.com/Work/image/work/icon4.png"
  45. width="68rpx" height="68rpx"></up-image>
  46. 保证金
  47. </view>
  48. <view class="mb20">{{ userInfo.baoPrice }}</view>
  49. <view @click="toBail" class="but">保证金中心</view>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. <view class="user-container">
  56. <view class="bgf pd4 radius20 mb28">
  57. <view class="mb28 flex flex-between">
  58. <view class="font36">我的宠物</view>
  59. <view @click="toMyPet" style="color: #707070">更多 ></view>
  60. </view>
  61. <view>
  62. <!-- <up-button v-if="getIsLogin()" class="mb20" size="large" style="width: 500rpx" type="primary"
  63. text="请添加您的爱宠" shape="circle"
  64. color="linear-gradient(to right, rgb(255 ,191 ,96 ,1), rgb(255, 51, 186))"></up-button> -->
  65. <view v-if="isLogin && pet.id" class="cw-box radius20 pd20 flex">
  66. <up-image class="mr20" width="140rpx" style="flex-shrink: 0" height="140rpx"
  67. :src="pet?.headImage" shape="circle"></up-image>
  68. <view style="width: 418rpx">
  69. <view class="font32 mb20">{{ pet.nickName }}</view>
  70. <view class="font24 ellipsis">{{ pet.type }} | {{ pet.age }}</view>
  71. </view>
  72. </view>
  73. </view>
  74. </view>
  75. <view class="bgf pd40 radius20">
  76. <view class="font36 mb28">服务中心</view>
  77. <view class="flex flex-between font28 flex-wrap">
  78. <view class="icon-list" @click="toNext">
  79. <up-image class="mb20" src="https://cdn.catmdogd.com/Work/image/work/icon1.png" width="68rpx"
  80. height="68rpx"></up-image>
  81. <view>我的评价</view>
  82. </view>
  83. <view @click="platformProtocol" class="icon-list">
  84. <up-image class="mb20" :show-loading="true"
  85. src="https://cdn.catmdogd.com/Work/image/work/icon2.png" width="68rpx"
  86. height="68rpx"></up-image>
  87. <view>平台协议</view>
  88. </view>
  89. <button plain class="btn-share" open-type="contact">
  90. <view class="icon-list">
  91. <up-image class="mb20" :show-loading="true"
  92. src="https://cdn.catmdogd.com/Work/image/work/icon3.png" width="68rpx"
  93. height="68rpx"></up-image>
  94. <view>联系客服</view>
  95. </view>
  96. </button>
  97. <button plain class="btn-share" open-type="share">
  98. <view class="icon-list">
  99. <up-image class="mb20" :show-loading="true"
  100. src="https://t9.baidu.com/it/u=2834693008,3232051400&fm=193" width="68rpx"
  101. height="68rpx"></up-image>
  102. <view>分享好友</view>
  103. </view>
  104. </button>
  105. </view>
  106. <view class="flex flex-between font28 flex-wrap mt20">
  107. <view class="icon-list" @click="logout">
  108. <up-image class="mb20"
  109. src="https://cdn.catmdogd.com/2025/04/01ab556ca51d2a4f82896c1e6fd0034a8b7shDr3f7qeDQ527d93075294e7237cee8b6c7d613be8.png"
  110. width="68rpx" height="68rpx" bgColor="#ffffff"></up-image>
  111. <view>退出登录</view>
  112. </view>
  113. </view>
  114. </view>
  115. </view>
  116. </view>
  117. <up-popup :show="show" @close="close" :round="10">
  118. <view style="padding: 10rpx 20rpx;height: 50vh;overflow-y: scroll;" v-html="content"></view>
  119. </up-popup>
  120. <Modal @confirm="confirmLogout" @cancel="cancelLogout" ref="modal">
  121. <template>
  122. <view class="tip">
  123. 确认退出登录?
  124. </view>
  125. </template>
  126. </Modal>
  127. </template>
  128. <script setup>
  129. import {
  130. computed,
  131. onMounted,
  132. ref
  133. } from "vue"
  134. import {
  135. getIsLogin,
  136. getStorage,
  137. getToken,
  138. removeIsLogin
  139. } from "../../utils/auth";
  140. import { getLoginStatus } from "@/utils/useMixin.js"
  141. import tab from "../../plugins/tab";
  142. import Modal from "@/components/Modal/index.vue"
  143. import {
  144. useStore
  145. } from "vuex"
  146. import {
  147. onShow,
  148. onShareAppMessage,
  149. } from "@dcloudio/uni-app"
  150. import {
  151. getpetList
  152. } from "@/api/pet/index.js"
  153. onShow(() => {
  154. if (!getLoginStatus()) return;
  155. getPet();
  156. })
  157. onMounted(() => {
  158. content.value = configList.value?.['home_agreement']?.paramValueArea || ""
  159. // 分享好友
  160. onShareAppMessage(() => {
  161. return {
  162. title: configList.value.applet_info.paramValueText, // 分享标题
  163. imageUrl: configList.value.applet_info.paramValueImage, // 分享图片地址,非必须
  164. path: '/pages/workbenchManage/index', // 分享路径
  165. };
  166. })
  167. })
  168. const store = useStore();
  169. const isLogin = ref(false)
  170. const userInfo = computed(() => {
  171. return store.getters.userInfo
  172. })
  173. const configList = computed(() => {
  174. return store.getters.configList;;
  175. })
  176. const pet = ref({})
  177. const show = ref(false)
  178. const content = ref("")
  179. const modal = ref(null)
  180. const LEVEL_AND_KEY_FIELDS_MAPPING = {
  181. '1': 'primary',
  182. '2': 'intermediate',
  183. '3': 'senior',
  184. }
  185. // 按伴宠师等级选中图标
  186. const petMaster = computed(() => {
  187. const { userBcs, userBcsRole } = userInfo.value
  188. if (!userBcs) {
  189. return ''
  190. }
  191. const key = `pet_${LEVEL_AND_KEY_FIELDS_MAPPING[userBcsRole]}`
  192. return configList.value?.[key]?.paramValueImage
  193. })
  194. // 按合伙人等级选中图标
  195. const partnerMaster = computed(() => {
  196. const { userHh } = userInfo.value
  197. if (!userHh) {
  198. return ''
  199. }
  200. const key = `partner_${LEVEL_AND_KEY_FIELDS_MAPPING[userHh]}`
  201. return configList.value?.[key]?.paramValueImage
  202. })
  203. if (getIsLogin() && getToken()) {
  204. userInfo.value = getStorage("userInfo")
  205. isLogin.value = true
  206. }
  207. const toNext = () => {
  208. uni.navigateTo({
  209. url: "/otherPages/orderTakingManage/evaluate/index"
  210. })
  211. }
  212. const toRunningWater = () => {
  213. uni.navigateTo({
  214. url: "/otherPages/myOrdersManage/transaction/index"
  215. })
  216. }
  217. const getPet = async () => {
  218. let response = await getpetList();
  219. pet.value = response?.data[0] || {};
  220. }
  221. const logout = () => {
  222. modal.value.open();
  223. }
  224. // 跳转提现
  225. const toWithdrawDeposit = () => {
  226. uni.navigateTo({
  227. url: "/otherPages/myOrdersManage/withdrawal/index"
  228. })
  229. }
  230. //跳转保证金
  231. const toBail = () => {
  232. uni.navigateTo({
  233. url: "/otherPages/myOrdersManage/bond/index"
  234. })
  235. }
  236. // 跳转我的宠物
  237. const toMyPet = () => {
  238. uni.navigateTo({
  239. url: '/otherPages/userManage/pet/index'
  240. });
  241. }
  242. const close = () => {
  243. show.value = false;
  244. }
  245. const confirmLogout = () => {
  246. store.commit("setUserInfo", {});
  247. uni.removeStorageSync("token")
  248. uni.removeStorageSync("baseInfo")
  249. removeIsLogin();
  250. uni.navigateTo({
  251. url: "/pages/login/index"
  252. })
  253. }
  254. const platformProtocol = () => {
  255. show.value = true;
  256. }
  257. const cancelLogout = () => {
  258. // 取消退出登录回调
  259. }
  260. </script>
  261. <style scoped lang="scss">
  262. @import "index";
  263. .tip {
  264. text-align: center;
  265. padding-bottom: 20rpx;
  266. }
  267. </style>