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

235 lines
5.4 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
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="swiper-container">
  4. <swiper :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000" style="height: 370rpx;">
  5. <swiper-item class="w-100 h-100" v-for="item in state.banner" :key="item.id">
  6. <image class="w-100 h-100" :src="item.image" mode=""></image>
  7. </swiper-item>
  8. </swiper>
  9. </view>
  10. <view class="container">
  11. <view class="container-list">
  12. <view class="mb28 col3 font32">合伙人工作台</view>
  13. <!-- 申请加入 -->
  14. <view class="container-list-but font28" v-if="userInfo.userHh!==1">
  15. <view class="flex flex-between">
  16. <view>
  17. <view class="font24 add-but col-white" @click="handleJoin(1)">申请加入 ></view>
  18. </view>
  19. </view>
  20. </view>
  21. <!-- 申请加入后 -->
  22. <view class="flex flex-between font24 flex-wrap" v-if="userInfo.userHh==1">
  23. <view class="icon-list" @click="handleGoto(1,item)" v-for="item in iconState.list1" :key="item.id">
  24. <up-image class="mb20" :show-loading="true" :src="item.image" width="68rpx"
  25. height="68rpx"></up-image>
  26. <view>{{item.name}}</view>
  27. </view>
  28. <view class="icon-list"></view>
  29. </view>
  30. </view>
  31. <view class="container-list">
  32. <view class="mb28 col3 font32">伴宠师工作台</view>
  33. <!-- 申请之前 -->
  34. <view class="container-list-but" style="background: #FFECE5" v-if="userInfo.userBcs!==1">
  35. <view class="flex flex-between">
  36. <view>
  37. <view class="font24 add-but col-white" style="background: #FF8343" @click="handleJoin(2)">
  38. 申请加入 ></view>
  39. </view>
  40. </view>
  41. </view>
  42. <!-- 申请之后 -->
  43. <view class="flex-rowl flex-wrap" v-if="userInfo.userBcs===1">
  44. <view class="icon-list" v-for="item in iconState.list2" :key="item.id" @click="handleClick(item)">
  45. <up-image class="mb20" :show-loading="true" :src="item.image" width="68rpx"
  46. height="68rpx"></up-image>
  47. <view>{{ item.name }}</view>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. <ModalCom :open="isoOpen" @close="modalClose" />
  53. </view>
  54. </template>
  55. <script setup>
  56. import ModalCom from "./components/modal.vue"
  57. import {
  58. onShow
  59. } from "@dcloudio/uni-app"
  60. import {
  61. banner,
  62. joinHh,
  63. joiBcs,
  64. indexConfig,
  65. indexConfigIco,
  66. getbaseInfo
  67. } from "../../api/home.js"
  68. import {
  69. computed,
  70. onMounted,
  71. reactive,
  72. ref
  73. } from "vue";
  74. import tab from "../../plugins/tab";
  75. import {
  76. getLoginStatus
  77. } from "../../utils/useMixin";
  78. import {
  79. useStore
  80. } from "vuex"
  81. const store = useStore();
  82. const state = reactive({
  83. banner: []
  84. })
  85. onMounted(() => {
  86. getBanner()
  87. getpz()
  88. console.log("userInfo", userInfo)
  89. })
  90. const userInfo = computed(() => {
  91. return store.getters.userInfo
  92. })
  93. onShow(() => {
  94. })
  95. // 获取轮播图
  96. const getBanner = async () => {
  97. const res = await banner()
  98. if (res.code === 200) {
  99. state.banner = [...res.data]
  100. }
  101. }
  102. // 申请加入合伙人
  103. const num = ref(0)
  104. const isoOpen = ref(false)
  105. const handleJoin = (type) => {
  106. num.value = Number(type)
  107. const info = uni.getStorageSync("baseInfo")
  108. if (!info) {
  109. uni.navigateTo({
  110. url: "/pages/login/index"
  111. })
  112. return
  113. }
  114. const baseInfo = JSON.parse(info)
  115. if (type === 1) {
  116. joinHh({
  117. appUserId: baseInfo.userId
  118. }).then(res => {
  119. isoOpen.value = true
  120. changeBaseInfo(baseInfo.userId)
  121. }).catch(() => {})
  122. } else {
  123. joiBcs({
  124. appUserId: baseInfo.userId
  125. }).then(res => {
  126. isoOpen.value = true
  127. changeBaseInfo(baseInfo.userId)
  128. })
  129. }
  130. }
  131. // 更新基本信息
  132. const changeBaseInfo = (userId) => {
  133. getbaseInfo(userId).then(res => {
  134. })
  135. }
  136. const modalClose = () => {
  137. isoOpen.value = false
  138. if (num.value === 1) {
  139. show.value = false
  140. } else {
  141. show.value = false
  142. }
  143. }
  144. // 获取工作台图标
  145. const iconState = reactive({
  146. list1: [],
  147. list2: [],
  148. })
  149. const getpz = () => {
  150. indexConfig().then(res => {
  151. // 合伙人工作台菜单
  152. iconState.list1 = res?.rows?.slice(0, 4) || [];
  153. // 伴宠师工作台
  154. iconState.list2 = res?.rows?.slice(4) || [];
  155. })
  156. }
  157. const show = ref(true)
  158. const hhShow = ref(true)
  159. const handleGoto = (val, item) => {
  160. switch (item.id) {
  161. case 1:
  162. tab.navigateTo('/otherPages/binding/list/index')
  163. break;
  164. case 2:
  165. tab.navigateTo('/otherPages/workbenchManage/myUser/index')
  166. break;
  167. case 3:
  168. tab.navigateTo('/otherPages/workbenchManage/myLevel/index')
  169. break;
  170. case 4:
  171. // tab.navigateTo('/otherPages/binding/wallet/index')
  172. tab.navigateTo('/otherPages/workbenchManage/myWallet/index')
  173. break;
  174. }
  175. }
  176. // 加入合伙人
  177. const handleAdd = (type) => {
  178. if (!getLoginStatus()) return
  179. switch (type) {
  180. case 1:
  181. break
  182. case 2:
  183. tab.navigateTo("/otherPages/workbenchManage/feedingStaff/index")
  184. break
  185. }
  186. }
  187. const handleClick = (item) => {
  188. switch (item.code) {
  189. case "1":
  190. uni.navigateTo({
  191. url: "/otherPages/authentication/serve/index"
  192. })
  193. break;
  194. case "2":
  195. uni.navigateTo({
  196. url: "/otherPages/authentication/serve/record"
  197. })
  198. break;
  199. case "3":
  200. uni.navigateTo({
  201. url: "/otherPages/authentication/connectAddress/index"
  202. })
  203. break;
  204. case "4":
  205. break;
  206. case "5":
  207. uni.navigateTo({
  208. url: "/otherPages/orderTakingManage/evaluate/index"
  209. })
  210. break;
  211. }
  212. }
  213. const handleOpen = () => {
  214. show.value = false
  215. }
  216. const handleBc = () => {
  217. uni.navigateTo({
  218. url: "/otherPages/authentication/list/index"
  219. })
  220. }
  221. </script>
  222. <style scoped lang="scss">
  223. @import "index";
  224. </style>