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

269 lines
7.5 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
  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. {{getIsLogin()?userInfo.userName:"欢迎来到版宠师"}}
  12. <image class="petMaster" :src="petMaster" mode="aspectFit"></image>
  13. <image class="petMaster" :src="partnerMaster" mode="aspectFit"></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>
  103. </view>
  104. </view>
  105. <up-popup :show="show" @close="close" :round="10">
  106. <view style="padding: 10rpx 20rpx;height: 50vh;overflow-y: scroll;" v-html="content"></view>
  107. </up-popup>
  108. </template>
  109. <script setup>
  110. import {
  111. computed,
  112. onMounted,
  113. ref
  114. } from "vue"
  115. import {
  116. getIsLogin,
  117. getStorage,
  118. getToken,
  119. removeIsLogin
  120. } from "../../utils/auth";
  121. import tab from "../../plugins/tab";
  122. import {
  123. useStore
  124. } from "vuex"
  125. import {
  126. onShow,
  127. onShareAppMessage,
  128. } from "@dcloudio/uni-app"
  129. import {
  130. getpetList
  131. } from "@/api/pet/index.js"
  132. onShow(() => {
  133. if (!getIsLogin()) {
  134. uni.navigateTo({
  135. url: "/pages/login/index"
  136. })
  137. }
  138. getPetList();
  139. })
  140. onMounted(() => {
  141. content.value = configList.value?.['home_agreement']?.paramValueArea || ""
  142. // 分享好友
  143. onShareAppMessage(() => {
  144. return {
  145. title: configList.value.applet_info.paramValueText, // 分享标题
  146. imageUrl: configList.value.applet_info.paramValueImage, // 分享图片地址,非必须
  147. path: '/pages/workbenchManage/index', // 分享路径
  148. };
  149. })
  150. })
  151. const store = useStore();
  152. const isLogin = ref(false)
  153. const userInfo = computed(() => {
  154. return store.getters.userInfo
  155. })
  156. const configList = computed(() => {
  157. return store.getters.configList;;
  158. })
  159. const pet = ref({})
  160. const show = ref(false)
  161. const content = ref("")
  162. const petMasterLevel = ref(1);
  163. const partnerLevel = ref(0);
  164. // 伴宠师图标
  165. const petMaster = computed(() => {
  166. const paths = [configList.value?.pet_primary?.paramValueImage, configList.value?.pet_senior
  167. ?.paramValueImage
  168. ];
  169. return paths[petMasterLevel.value];
  170. })
  171. // 合伙人图标
  172. const partnerMaster = computed(() => {
  173. const paths = [configList.value?.partner_intermediate?.paramValueImage, configList.value?.partner_senior
  174. ?.paramValueImage
  175. ];
  176. return paths[partnerLevel.value];
  177. })
  178. if (getIsLogin() && getToken()) {
  179. userInfo.value = getStorage("userInfo")
  180. isLogin.value = true
  181. }
  182. const toNext = () => {
  183. uni.navigateTo({
  184. url: "/otherPages/orderTakingManage/evaluate/index"
  185. })
  186. }
  187. const toRunningWater = () => {
  188. uni.navigateTo({
  189. url: "/otherPages/myOrdersManage/transaction/index"
  190. })
  191. }
  192. const getPetList = async () => {
  193. let response = await getpetList();
  194. pet.value = response?.data[0] || {};
  195. }
  196. const logout = () => {
  197. store.commit("setUserInfo", {});
  198. uni.removeStorageSync("token")
  199. uni.removeStorageSync("baseInfo")
  200. removeIsLogin();
  201. uni.navigateTo({
  202. url: "/pages/login/index"
  203. })
  204. }
  205. // 跳转提现
  206. const toWithdrawDeposit = () => {
  207. uni.navigateTo({
  208. url: "/otherPages/myOrdersManage/withdrawal/index"
  209. })
  210. }
  211. //跳转保证金
  212. const toBail = () => {
  213. uni.navigateTo({
  214. url: "/otherPages/myOrdersManage/bond/index"
  215. })
  216. }
  217. // 跳转我的宠物
  218. const toMyPet = () => {
  219. uni.navigateTo({
  220. url: '/otherPages/userManage/pet/index'
  221. });
  222. }
  223. const close = () => {
  224. show.value = false;
  225. }
  226. const platformProtocol = () => {
  227. show.value = true;
  228. }
  229. // 定义 openCustomerServiceChat 方法,用于唤起客服会话界面
  230. const openCustomerServiceChat = () => {
  231. uni.openCustomerServiceChat({
  232. extInfo: {
  233. url: "https://work.weixin.qq.com/kfid/kfc135d138d063817e1"
  234. },
  235. sessionFrom: '1000',
  236. // 成功回调函数
  237. success: function(res) {
  238. console.log('成功打开客服会话', res);
  239. },
  240. // 失败回调函数
  241. fail: function(err) {
  242. console.error('打开客服会话失败', err);
  243. }
  244. });
  245. };
  246. </script>
  247. <style scoped lang="scss">
  248. @import "index";
  249. </style>