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

271 lines
6.5 KiB

3 months ago
3 months ago
3 months ago
3 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
3 months ago
3 months ago
3 months ago
3 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.indexIcon" width="68rpx"
  28. height="68rpx"></up-image>
  29. <view>{{item.indexInfo}}</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.accompanyData" :key="item.id"
  53. @click="handleClick(item)">
  54. <up-image class="mb20" :show-loading="true" :src="item.indexIcon" width="68rpx"
  55. height="68rpx"></up-image>
  56. <view>{{ item.indexInfo }}</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 accompanyData = [{
  87. name: "服务信息",
  88. code: '1',
  89. url: ""
  90. }, {
  91. name: "服务记录",
  92. code: '2',
  93. url: ""
  94. }, {
  95. name: "接单地址",
  96. code: '3',
  97. url: ""
  98. }, {
  99. name: "平台手册",
  100. code: '4',
  101. url: ""
  102. }, {
  103. name: "我的评价",
  104. code: '5',
  105. url: ""
  106. }]
  107. const state = reactive({
  108. banner: []
  109. })
  110. onMounted(() => {
  111. getBanner()
  112. getpz()
  113. })
  114. const userHh = ref(0)
  115. const userBcs = ref(0)
  116. onShow(() => {
  117. const info = uni.getStorageSync("baseInfo")
  118. if (info) {
  119. const baseInfo = JSON.parse(info)
  120. userHh.value = baseInfo.userHh === 1 ? 0 : 1
  121. userBcs.value = baseInfo.userBcs === 1 ? 0 : 1
  122. if (userHh.value === 1 || userBcs.value === 1) {
  123. show.value = false
  124. }
  125. }
  126. })
  127. // 获取轮播图
  128. const getBanner = async () => {
  129. const res = await banner()
  130. if (res.code === 200) {
  131. state.banner = [...res.data]
  132. }
  133. }
  134. // 申请加入合伙人
  135. const num = ref(0)
  136. const isoOpen = ref(false)
  137. const handleJoin = (type) => {
  138. num.value = Number(type)
  139. const info = uni.getStorageSync("baseInfo")
  140. if (!info) {
  141. uni.navigateTo({
  142. url: "/pages/login/index"
  143. })
  144. return
  145. }
  146. const baseInfo = JSON.parse(info)
  147. if (type === 1) {
  148. joinHh({
  149. appUserId: baseInfo.userId
  150. }).then(res => {
  151. isoOpen.value = true
  152. changeBaseInfo(baseInfo.userId)
  153. }).catch(() => {})
  154. } else {
  155. joiBcs({
  156. appUserId: baseInfo.userId
  157. }).then(res => {
  158. isoOpen.value = true
  159. changeBaseInfo(baseInfo.userId)
  160. })
  161. }
  162. }
  163. // 更新基本信息
  164. const changeBaseInfo = (userId) => {
  165. getbaseInfo(userId).then(res => {
  166. })
  167. }
  168. const modalClose = () => {
  169. isoOpen.value = false
  170. if (num.value === 1) {
  171. show.value = false
  172. userHh.value = 1
  173. } else {
  174. show.value = false
  175. userBcs.value = 1
  176. }
  177. }
  178. // 获取工作台图标
  179. const iconState = reactive({
  180. list1: [],
  181. list2: [],
  182. accompanyData: []
  183. })
  184. const getpz = () => {
  185. indexConfig().then(res => {
  186. iconState.list1 = res.rows
  187. })
  188. indexConfigIco().then(res => {
  189. iconState.list2 = res.data
  190. })
  191. }
  192. const show = ref(true)
  193. const hhShow = ref(true)
  194. const handleGoto = (val, item) => {
  195. console.log(item)
  196. switch (item.id) {
  197. case 1:
  198. tab.navigateTo('/otherPages/binding/list/index')
  199. break;
  200. case 2:
  201. tab.navigateTo('/otherPages/workbenchManage/myUser/index')
  202. break;
  203. case 3:
  204. tab.navigateTo('/otherPages/workbenchManage/myLevel/index')
  205. break;
  206. case 4:
  207. // tab.navigateTo('/otherPages/binding/wallet/index')
  208. tab.navigateTo('/otherPages/workbenchManage/myWallet/index')
  209. break;
  210. }
  211. }
  212. // 加入合伙人
  213. const handleAdd = (type) => {
  214. if (!getLoginStatus()) return
  215. switch (type) {
  216. case 1:
  217. break
  218. case 2:
  219. tab.navigateTo("/otherPages/workbenchManage/feedingStaff/index")
  220. break
  221. }
  222. }
  223. const handleClick = (item) => {
  224. switch (item.code) {
  225. case "1":
  226. uni.navigateTo({
  227. url: "/otherPages/authentication/serve/index"
  228. })
  229. break;
  230. case "2":
  231. uni.navigateTo({
  232. url: "/otherPages/authentication/serve/record"
  233. })
  234. break;
  235. case "3":
  236. uni.navigateTo({
  237. url: "/otherPages/authentication/connectAddress/index"
  238. })
  239. break;
  240. case "4":
  241. break;
  242. case "5":
  243. uni.navigateTo({
  244. url: "/otherPages/orderTakingManage/evaluate/index"
  245. })
  246. break;
  247. }
  248. }
  249. const handleOpen = () => {
  250. show.value = false
  251. }
  252. const handleBc = () => {
  253. uni.navigateTo({
  254. url: "/otherPages/authentication/list/index"
  255. })
  256. }
  257. </script>
  258. <style scoped lang="scss">
  259. @import "index";
  260. </style>