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

253 lines
6.4 KiB

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