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

236 lines
6.7 KiB

4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
  1. <template>
  2. <view>
  3. <view class="user-header">
  4. <view class="flex flex-between login">
  5. <view class="flex">
  6. <up-image class="mr20" width="120rpx" height="120rpx" :src="userInfo.userImage"
  7. shape="circle"></up-image>
  8. <view>{{getIsLogin()?userInfo.userName:"欢迎来到版宠师"}}</view>
  9. </view>
  10. <view style="width: 140rpx">
  11. <up-button v-if="!getIsLogin()" @click="handleLogin" :customStyle="{borderColor:'#fff'}"
  12. type="primary" text="请登录" shape="circle" color="#FFBF60"></up-button>
  13. <up-button v-else @click="logout" :customStyle="{borderColor:'#fff'}" type="primary" text="退出登录"
  14. shape="circle" color="#FFBF60"></up-button>
  15. </view>
  16. </view>
  17. <view class="header-money">
  18. <view class="header-money-list">
  19. <view class="header-money-item flex flex-evenly">
  20. <view style="text-align: center">
  21. <view class="mb20 flex">
  22. <up-image :show-loading="true" src="https://cdn.catmdogd.com/Work/image/work/icon4.png"
  23. width="68rpx" height="68rpx"></up-image>
  24. 服务酬劳
  25. </view>
  26. <view class="mb20">{{ userInfo.price }}</view>
  27. <view class="flex flex-between but">
  28. <view @click="toWithdrawDeposit">提现</view>
  29. <view>|</view>
  30. <view @click="toRunningWater">明细</view>
  31. </view>
  32. </view>
  33. <view style="text-align: center">
  34. <view class="mb20 flex">
  35. <up-image :show-loading="true" src="https://cdn.catmdogd.com/Work/image/work/icon4.png"
  36. width="68rpx" height="68rpx"></up-image>
  37. 保证金
  38. </view>
  39. <view class="mb20">{{ userInfo.baoPrice }}</view>
  40. <view @click="toBail" class="but">保证金中心</view>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. <view class="user-container">
  47. <view class="bgf pd4 radius20 mb28">
  48. <view class="mb28 flex flex-between">
  49. <view class="font36">我的宠物</view>
  50. <view @click="toMyPet" style="color: #707070">更多 ></view>
  51. </view>
  52. <view>
  53. <up-button v-if="!getIsLogin()" @click="handleLogin" class="mb20" size="large"
  54. style="width: 600rpx;height: 135rpx;" type="primary" text="登录后管理宠物" shape=""
  55. color="#FFF4E5"></up-button>
  56. <!-- <up-button v-if="getIsLogin()" class="mb20" size="large" style="width: 500rpx" type="primary"
  57. text="请添加您的爱宠" shape="circle"
  58. color="linear-gradient(to right, rgb(255 ,191 ,96 ,1), rgb(255, 51, 186))"></up-button> -->
  59. <view v-if="isLogin" class="cw-box radius20 pd20 flex">
  60. <up-image class="mr20" width="140rpx" style="flex-shrink: 0" height="140rpx"
  61. :src="pet?.headImage" shape="circle"></up-image>
  62. <view style="width: 418rpx">
  63. <view class="font32 mb20">{{ pet.type }}</view>
  64. <view class="font24 ellipsis">澳大利亚雾猫澳洲斑点雾猫| 1 个月</view>
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. <view class="bgf pd40 radius20">
  70. <view class="font36 mb28">服务中心</view>
  71. <view class="flex flex-between font28 flex-wrap">
  72. <view class="icon-list" @click="toNext">
  73. <up-image class="mb20" src="https://cdn.catmdogd.com/Work/image/work/icon1.png" width="68rpx"
  74. height="68rpx"></up-image>
  75. <view>我的评价</view>
  76. </view>
  77. <view @click="platformProtocol" class="icon-list">
  78. <up-image class="mb20" :show-loading="true"
  79. src="https://cdn.catmdogd.com/Work/image/work/icon2.png" width="68rpx"
  80. height="68rpx"></up-image>
  81. <view>平台协议</view>
  82. </view>
  83. <view @click="openCustomerServiceChat" class="icon-list">
  84. <up-image class="mb20" :show-loading="true"
  85. src="https://cdn.catmdogd.com/Work/image/work/icon3.png" width="68rpx"
  86. height="68rpx"></up-image>
  87. <view>联系客服</view>
  88. </view>
  89. <view class="icon-list">
  90. <up-image class="mb20" :show-loading="true"
  91. src="https://t9.baidu.com/it/u=2834693008,3232051400&fm=193" width="68rpx"
  92. height="68rpx"></up-image>
  93. <view>分享好友</view>
  94. </view>
  95. </view>
  96. </view>
  97. </view>
  98. </view>
  99. <up-popup :show="show" @close="close" :round="10">
  100. <view style="padding: 10rpx 20rpx;height: 50vh;overflow-y: scroll;" v-html="content"></view>
  101. </up-popup>
  102. </template>
  103. <script setup>
  104. import {
  105. computed,
  106. onMounted,
  107. ref
  108. } from "vue"
  109. import {
  110. getIsLogin,
  111. getStorage,
  112. getToken,
  113. removeIsLogin
  114. } from "../../utils/auth";
  115. import tab from "../../plugins/tab";
  116. import {
  117. useStore
  118. } from "vuex"
  119. import {
  120. onShow
  121. } from "@dcloudio/uni-app"
  122. import {
  123. petList
  124. } from "@/api/pet/index.js"
  125. onShow(() => {
  126. if (!getIsLogin()) {
  127. uni.navigateTo({
  128. url: "/pages/login/index"
  129. })
  130. }
  131. getPetList();
  132. })
  133. onMounted(() => {
  134. content.value = configList.value?.['home-agreement']?.paramValueArea || ""
  135. })
  136. const store = useStore();
  137. const isLogin = ref(false)
  138. const userInfo = computed(() => {
  139. return store.getters.userInfo
  140. })
  141. const configList = computed(() => {
  142. return store.getters.configList;;
  143. })
  144. const pet = ref({})
  145. const show = ref(false)
  146. const content = ref("")
  147. if (getIsLogin() && getToken()) {
  148. userInfo.value = getStorage("userInfo")
  149. isLogin.value = true
  150. }
  151. const handleLogin = () => {
  152. tab.navigateTo('/pages/login/index')
  153. }
  154. const toNext = () => {
  155. uni.navigateTo({
  156. url: "/otherPages/orderTakingManage/evaluate/index"
  157. })
  158. }
  159. const toRunningWater = () => {
  160. uni.navigateTo({
  161. url: "/otherPages/myOrdersManage/transaction/index"
  162. })
  163. }
  164. const getPetList = async () => {
  165. let response = await petList();
  166. pet.value = response?.data[0] || {};
  167. }
  168. const logout = () => {
  169. store.commit("setUserInfo", {});
  170. uni.removeStorageSync("token")
  171. uni.removeStorageSync("baseInfo")
  172. removeIsLogin();
  173. uni.navigateTo({
  174. url: "/pages/login/index"
  175. })
  176. }
  177. // 跳转提现
  178. const toWithdrawDeposit = () => {
  179. uni.navigateTo({
  180. url: "/otherPages/myOrdersManage/withdrawal/index"
  181. })
  182. }
  183. //跳转保证金
  184. const toBail = () => {
  185. uni.navigateTo({
  186. url: "/otherPages/myOrdersManage/bond/index"
  187. })
  188. }
  189. // 跳转我的宠物
  190. const toMyPet = () => {
  191. uni.navigateTo({
  192. url: '/otherPages/userManage/pet/index'
  193. });
  194. }
  195. const close = () => {
  196. show.value = false;
  197. }
  198. const platformProtocol = () => {
  199. show.value = true;
  200. }
  201. // 定义 openCustomerServiceChat 方法,用于唤起客服会话界面
  202. const openCustomerServiceChat = () => {
  203. uni.openCustomerServiceChat({
  204. extInfo: {
  205. url: "https://work.weixin.qq.com/kfid/kfc135d138d063817e1"
  206. },
  207. sessionFrom: '1000',
  208. // 成功回调函数
  209. success: function(res) {
  210. console.log('成功打开客服会话', res);
  211. },
  212. // 失败回调函数
  213. fail: function(err) {
  214. console.error('打开客服会话失败', err);
  215. }
  216. });
  217. };
  218. </script>
  219. <style scoped lang="scss">
  220. @import "index";
  221. </style>