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

300 lines
8.3 KiB

9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 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 tab from "../../plugins/tab";
  137. import Modal from "@/components/Modal/index.vue"
  138. import {
  139. useStore
  140. } from "vuex"
  141. import {
  142. onShow,
  143. onShareAppMessage,
  144. } from "@dcloudio/uni-app"
  145. import {
  146. getpetList
  147. } from "@/api/pet/index.js"
  148. onShow(() => {
  149. if (!getIsLogin()) {
  150. uni.navigateTo({
  151. url: "/pages/login/index"
  152. })
  153. }
  154. getPetList();
  155. })
  156. onMounted(() => {
  157. content.value = configList.value?.['home_agreement']?.paramValueArea || ""
  158. // 分享好友
  159. onShareAppMessage(() => {
  160. return {
  161. title: configList.value.applet_info.paramValueText, // 分享标题
  162. imageUrl: configList.value.applet_info.paramValueImage, // 分享图片地址,非必须
  163. path: '/pages/workbenchManage/index', // 分享路径
  164. };
  165. })
  166. })
  167. const store = useStore();
  168. const isLogin = ref(false)
  169. const userInfo = computed(() => {
  170. return store.getters.userInfo
  171. })
  172. const configList = computed(() => {
  173. return store.getters.configList;;
  174. })
  175. const pet = ref({})
  176. const show = ref(false)
  177. const content = ref("")
  178. const modal = ref(null)
  179. const petMasterLevel = ref(1)
  180. const partnerLevel = ref(0)
  181. // 按伴宠师等级选中图标
  182. const petMaster = computed(() => {
  183. const paths = [configList.value?.pet_primary?.paramValueImage, configList.value?.pet_senior
  184. ?.paramValueImage
  185. ];
  186. return paths[petMasterLevel.value];
  187. })
  188. // 按合伙人等级选中图标
  189. const partnerMaster = computed(() => {
  190. const paths = [configList.value?.partner_intermediate?.paramValueImage, configList.value?.partner_senior
  191. ?.paramValueImage
  192. ];
  193. return paths[partnerLevel.value];
  194. })
  195. if (getIsLogin() && getToken()) {
  196. userInfo.value = getStorage("userInfo")
  197. isLogin.value = true
  198. }
  199. const toNext = () => {
  200. uni.navigateTo({
  201. url: "/otherPages/orderTakingManage/evaluate/index"
  202. })
  203. }
  204. const toRunningWater = () => {
  205. uni.navigateTo({
  206. url: "/otherPages/myOrdersManage/transaction/index"
  207. })
  208. }
  209. const getPetList = async () => {
  210. let response = await getpetList();
  211. pet.value = response?.data[0] || {};
  212. }
  213. const logout = () => {
  214. modal.value.open();
  215. }
  216. // 跳转提现
  217. const toWithdrawDeposit = () => {
  218. uni.navigateTo({
  219. url: "/otherPages/myOrdersManage/withdrawal/index"
  220. })
  221. }
  222. //跳转保证金
  223. const toBail = () => {
  224. uni.navigateTo({
  225. url: "/otherPages/myOrdersManage/bond/index"
  226. })
  227. }
  228. // 跳转我的宠物
  229. const toMyPet = () => {
  230. uni.navigateTo({
  231. url: '/otherPages/userManage/pet/index'
  232. });
  233. }
  234. const close = () => {
  235. show.value = false;
  236. }
  237. const confirmLogout = () => {
  238. store.commit("setUserInfo", {});
  239. uni.removeStorageSync("token")
  240. uni.removeStorageSync("baseInfo")
  241. removeIsLogin();
  242. uni.navigateTo({
  243. url: "/pages/login/index"
  244. })
  245. }
  246. const platformProtocol = () => {
  247. show.value = true;
  248. }
  249. const cancelLogout = () => {
  250. // 取消退出登录回调
  251. }
  252. // 定义 openCustomerServiceChat 方法,用于唤起客服会话界面
  253. const openCustomerServiceChat = () => {
  254. uni.openCustomerServiceChat({
  255. extInfo: {
  256. url: "https://work.weixin.qq.com/kfid/kfc135d138d063817e1"
  257. },
  258. sessionFrom: '1000',
  259. // 成功回调函数
  260. success: function(res) {
  261. console.log('成功打开客服会话', res);
  262. },
  263. // 失败回调函数
  264. fail: function(err) {
  265. console.error('打开客服会话失败', err);
  266. }
  267. });
  268. };
  269. </script>
  270. <style scoped lang="scss">
  271. @import "index";
  272. .tip {
  273. text-align: center;
  274. padding: 25rpx 0rpx;
  275. }
  276. </style>