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

355 lines
11 KiB

1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
2 weeks ago
1 month ago
1 month ago
1 month ago
1 month ago
2 weeks ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
2 weeks ago
1 month ago
2 weeks ago
1 month ago
1 month ago
2 weeks ago
1 month ago
2 weeks 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. <up-image :show-loading="true" src="/static/images/user/q1.png"
  34. style="margin-right: 14rpx;"
  35. width="50rpx" height="50rpx"></up-image>
  36. 服务酬劳
  37. </view>
  38. <view class="mb20">{{ userInfo.price }}</view>
  39. <view class="flex flex-between but">
  40. <view @click="toWithdrawDeposit">提现</view>
  41. <view>|</view>
  42. <view @click="toRunningWater">明细</view>
  43. </view>
  44. </view>
  45. <view style="text-align: center">
  46. <view class="mb20 flex">
  47. <!-- <up-image :show-loading="true" src="https://cdn.catmdogd.com/Work/image/work/icon4.png"
  48. width="68rpx" height="68rpx"></up-image> -->
  49. <up-image :show-loading="true" src="/static/images/user/q2.png"
  50. style="margin-right: 14rpx;"
  51. width="50rpx" height="50rpx"></up-image>
  52. 保证金
  53. </view>
  54. <view class="mb20">{{ userInfo.baoPrice }}</view>
  55. <view @click="toBail" class="but">保证金中心</view>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. <view class="user-container">
  62. <view class="bgf pd4 radius20 mb28">
  63. <view class="mb28 flex flex-between">
  64. <view class="font36">我的爱宠</view>
  65. <view @click="toMyPet" style="color: #707070">更多 ></view>
  66. </view>
  67. <view>
  68. <!-- <up-button v-if="getIsLogin()" class="mb20" size="large" style="width: 500rpx" type="primary"
  69. text="请添加您的爱宠" shape="circle"
  70. color="linear-gradient(to right, rgb(255 ,191 ,96 ,1), rgb(255, 51, 186))"></up-button> -->
  71. <view v-if="isLogin && petList.length">
  72. <scroll-view scroll-x class="pet-scroll-container" show-scrollbar="false">
  73. <view class="pet-scroll-content">
  74. <view class="cw-box radius20 pd20 flex pet-item"
  75. v-for="(pet, inde) in petList"
  76. @click="editPet(pet)"
  77. :key="pet.id">
  78. <up-image class="mr20" width="120rpx" style="flex-shrink: 0" height="120rpx"
  79. :src="pet?.headImage" shape="circle"></up-image>
  80. <view style="width: 280rpx">
  81. <view class="font32 mb20 pet-name-container">
  82. {{ pet.nickName }}
  83. <text class="pet-gender" :class="{'pet-gender-male': pet.sex === 0, 'pet-gender-female': pet.sex === 1}">
  84. {{ pet.sex === 0 ? '♂' : '♀' }}
  85. </text>
  86. </view>
  87. <view class="font24 ellipsis">{{ pet.type }} | {{ pet.age }}</view>
  88. </view>
  89. </view>
  90. </view>
  91. </scroll-view>
  92. </view>
  93. <view class="no-pet-tip radius20 pd20 flex" v-else>
  94. <up-image class="mr20" width="80rpx" height="80rpx" src="https://image.hhlm1688.com/img/work/log/headImage.png" shape="circle"></up-image>
  95. <view class="no-pet-text">您还没有添加您的爱宠信息呢</view>
  96. <view class="add-pet-btn" @click="toMyPet">去添加</view>
  97. </view>
  98. </view>
  99. </view>
  100. <view class="bgf pd40 radius20">
  101. <view class="font36 mb28">服务中心</view>
  102. <view class="flex flex-between font28 flex-wrap">
  103. <view class="icon-list" @click="toNext">
  104. <!-- <up-image class="mb20" src="https://cdn.catmdogd.com/Work/image/work/icon1.png" width="68rpx"
  105. height="68rpx"></up-image> -->
  106. <up-image class="mb20" src="/static/images/user/1.png" width="58rpx"
  107. height="58rpx"></up-image>
  108. <view>我的评价</view>
  109. </view>
  110. <view @click="platformProtocol" class="icon-list">
  111. <!-- <up-image class="mb20" :show-loading="true"
  112. src="https://cdn.catmdogd.com/Work/image/work/icon2.png" width="68rpx"
  113. height="68rpx"></up-image> -->
  114. <up-image class="mb20" src="/static/images/user/2.png" width="58rpx"
  115. height="58rpx"></up-image>
  116. <view>平台协议</view>
  117. </view>
  118. <button plain class="btn-share" open-type="contact">
  119. <view class="icon-list">
  120. <!-- <up-image class="mb20" :show-loading="true"
  121. src="https://cdn.catmdogd.com/Work/image/work/icon3.png" width="68rpx"
  122. height="68rpx"></up-image> -->
  123. <up-image class="mb20" src="/static/images/user/4.png" width="58rpx"
  124. height="58rpx"></up-image>
  125. <view>联系客服</view>
  126. </view>
  127. </button>
  128. <button plain class="btn-share" open-type="share">
  129. <view class="icon-list">
  130. <!-- <up-image class="mb20" :show-loading="true"
  131. src="https://t9.baidu.com/it/u=2834693008,3232051400&fm=193" width="68rpx"
  132. height="68rpx"></up-image> -->
  133. <up-image class="mb20" src="/static/images/user/5.png" width="58rpx"
  134. height="58rpx"></up-image>
  135. <view>分享好友</view>
  136. </view>
  137. </button>
  138. </view>
  139. <!-- <view class="flex flex-between font28 flex-wrap mt20">
  140. <view class="icon-list" @click="logout">
  141. <up-image class="mb20"
  142. src="https://cdn.catmdogd.com/2025/04/01ab556ca51d2a4f82896c1e6fd0034a8b7shDr3f7qeDQ527d93075294e7237cee8b6c7d613be8.png"
  143. width="68rpx" height="68rpx" bgColor="#ffffff"></up-image>
  144. <view>退出登录</view>
  145. </view>
  146. </view> -->
  147. </view>
  148. </view>
  149. </view>
  150. <up-popup :show="show" @close="close" :round="10">
  151. <view style="padding: 10rpx 20rpx;height: 50vh;overflow-y: scroll;" v-html="content"></view>
  152. </up-popup>
  153. <Modal @confirm="confirmLogout" @cancel="cancelLogout" ref="modal">
  154. <template>
  155. <view class="tip">
  156. 确认退出登录?
  157. </view>
  158. </template>
  159. </Modal>
  160. </template>
  161. <script setup>
  162. import {
  163. computed,
  164. onMounted,
  165. ref
  166. } from "vue"
  167. import {
  168. getIsLogin,
  169. getStorage,
  170. getToken,
  171. removeIsLogin
  172. } from "../../utils/auth";
  173. import { getLoginStatus } from "@/utils/useMixin.js"
  174. import tab from "../../plugins/tab";
  175. import Modal from "@/components/Modal/index.vue"
  176. import {
  177. useStore
  178. } from "vuex"
  179. import {
  180. onShow,
  181. onShareAppMessage,
  182. } from "@dcloudio/uni-app"
  183. import {
  184. getpetList
  185. } from "@/api/pet/index.js"
  186. onShow(() => {
  187. if (!getLoginStatus()) return;
  188. getPet();
  189. })
  190. onMounted(() => {
  191. content.value = configList.value?.['home_agreement']?.paramValueArea || ""
  192. // 分享好友
  193. onShareAppMessage(() => {
  194. return {
  195. title: configList.value.applet_info.paramValueText, // 分享标题
  196. imageUrl: configList.value.applet_info.paramValueImage, // 分享图片地址,非必须
  197. path: '/pages/workbenchManage/index', // 分享路径
  198. };
  199. })
  200. })
  201. const store = useStore();
  202. const isLogin = ref(false)
  203. const userInfo = computed(() => {
  204. return store.getters.userInfo
  205. })
  206. const configList = computed(() => {
  207. return store.getters.configList;;
  208. })
  209. const petList = ref([])
  210. const show = ref(false)
  211. const content = ref("")
  212. const modal = ref(null)
  213. const LEVEL_AND_KEY_FIELDS_MAPPING = {
  214. '1': 'primary',
  215. '2': 'intermediate',
  216. '3': 'senior',
  217. }
  218. // 按伴宠师等级选中图标
  219. const petMaster = computed(() => {
  220. const { userBcs, userBcsRole } = userInfo.value
  221. if (!userBcs) {
  222. return ''
  223. }
  224. const key = `pet_${LEVEL_AND_KEY_FIELDS_MAPPING[userBcsRole]}`
  225. return configList.value?.[key]?.paramValueImage
  226. })
  227. // 按合伙人等级选中图标
  228. const partnerMaster = computed(() => {
  229. const { userHh } = userInfo.value
  230. if (!userHh) {
  231. return ''
  232. }
  233. const key = `partner_${LEVEL_AND_KEY_FIELDS_MAPPING[userHh]}`
  234. return configList.value?.[key]?.paramValueImage
  235. })
  236. if (getIsLogin() && getToken()) {
  237. userInfo.value = getStorage("userInfo")
  238. isLogin.value = true
  239. }
  240. const toNext = () => {
  241. uni.navigateTo({
  242. url: "/otherPages/orderTakingManage/evaluate/index"
  243. })
  244. }
  245. const toRunningWater = () => {
  246. uni.navigateTo({
  247. url: "/otherPages/myOrdersManage/transaction/index"
  248. })
  249. }
  250. const editPet = (item) => {
  251. if (item.petType === '猫咪' || item.petType === 0) {
  252. uni.navigateTo({
  253. url: `/otherPages/userManage/pet/petInfo?petType=0&optionType=edit&petId=${item.id}`
  254. })
  255. }
  256. if (item.petType === '狗狗' || item.petType === 1) {
  257. uni.navigateTo({
  258. url: `/otherPages/userManage/pet/petInfo?petType=1&optionType=edit&petId=${item.id}`
  259. })
  260. }
  261. };
  262. const getPet = async () => {
  263. let response = await getpetList();
  264. petList.value = response?.data || [];
  265. }
  266. const logout = () => {
  267. modal.value.open();
  268. }
  269. // 跳转提现
  270. const toWithdrawDeposit = () => {
  271. uni.navigateTo({
  272. url: "/otherPages/myOrdersManage/withdrawal/index"
  273. })
  274. }
  275. //跳转保证金
  276. const toBail = () => {
  277. uni.navigateTo({
  278. url: "/otherPages/myOrdersManage/bond/index"
  279. })
  280. }
  281. // 跳转我的宠物
  282. const toMyPet = () => {
  283. uni.navigateTo({
  284. url: '/otherPages/userManage/pet/index'
  285. });
  286. }
  287. const close = () => {
  288. show.value = false;
  289. }
  290. const confirmLogout = () => {
  291. store.commit("setUserInfo", {});
  292. uni.removeStorageSync("token")
  293. uni.removeStorageSync("baseInfo")
  294. removeIsLogin();
  295. uni.navigateTo({
  296. url: "/pages/login/index"
  297. })
  298. }
  299. const platformProtocol = () => {
  300. show.value = true;
  301. }
  302. const cancelLogout = () => {
  303. // 取消退出登录回调
  304. }
  305. </script>
  306. <style scoped lang="scss">
  307. @import "index";
  308. .tip {
  309. text-align: center;
  310. padding-bottom: 20rpx;
  311. }
  312. </style>