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

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