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

277 lines
6.6 KiB

3 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
3 months ago
2 months ago
3 months ago
3 months ago
3 months ago
3 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
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">合伙人工作台{{state}}</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.accompanyData" :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 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. userHh.value == 1
  126. userBcs.value == 1
  127. // }
  128. })
  129. // 获取轮播图
  130. const getBanner = async () => {
  131. const res = await banner()
  132. if (res.code === 200) {
  133. console.log("banner图",res)
  134. state.banner = [...res.data]
  135. console.log("state.banner",state.banner)
  136. }
  137. }
  138. // 申请加入合伙人
  139. const num = ref(0)
  140. const isoOpen = ref(false)
  141. const handleJoin = (type) => {
  142. num.value = Number(type)
  143. const info = uni.getStorageSync("baseInfo")
  144. if (!info) {
  145. uni.navigateTo({
  146. url: "/pages/login/index"
  147. })
  148. return
  149. }
  150. const baseInfo = JSON.parse(info)
  151. if (type === 1) {
  152. joinHh({
  153. appUserId: baseInfo.userId
  154. }).then(res => {
  155. isoOpen.value = true
  156. changeBaseInfo(baseInfo.userId)
  157. }).catch(() => {})
  158. } else {
  159. joiBcs({
  160. appUserId: baseInfo.userId
  161. }).then(res => {
  162. isoOpen.value = true
  163. changeBaseInfo(baseInfo.userId)
  164. })
  165. }
  166. }
  167. // 更新基本信息
  168. const changeBaseInfo = (userId) => {
  169. getbaseInfo(userId).then(res => {
  170. })
  171. }
  172. const modalClose = () => {
  173. isoOpen.value = false
  174. if (num.value === 1) {
  175. show.value = false
  176. userHh.value = 1
  177. } else {
  178. show.value = false
  179. userBcs.value = 1
  180. }
  181. }
  182. // 获取工作台图标
  183. const iconState = reactive({
  184. list1: [],
  185. list2: [],
  186. accompanyData: []
  187. })
  188. const getpz = () => {
  189. indexConfig().then(res => {
  190. iconState.list1 = res.rows
  191. })
  192. indexConfigIco().then(res => {
  193. iconState.list2 = res.data
  194. })
  195. }
  196. const show = ref(true)
  197. const hhShow = ref(true)
  198. const handleGoto = (val, item) => {
  199. console.log(item)
  200. switch (item.id) {
  201. case 1:
  202. tab.navigateTo('/otherPages/binding/list/index')
  203. break;
  204. case 2:
  205. tab.navigateTo('/otherPages/workbenchManage/myUser/index')
  206. break;
  207. case 3:
  208. tab.navigateTo('/otherPages/workbenchManage/myLevel/index')
  209. break;
  210. case 4:
  211. // tab.navigateTo('/otherPages/binding/wallet/index')
  212. tab.navigateTo('/otherPages/workbenchManage/myWallet/index')
  213. break;
  214. }
  215. }
  216. // 加入合伙人
  217. const handleAdd = (type) => {
  218. if (!getLoginStatus()) return
  219. switch (type) {
  220. case 1:
  221. break
  222. case 2:
  223. tab.navigateTo("/otherPages/workbenchManage/feedingStaff/index")
  224. break
  225. }
  226. }
  227. const handleClick = (item) => {
  228. switch (item.code) {
  229. case "1":
  230. uni.navigateTo({
  231. url: "/otherPages/authentication/serve/index"
  232. })
  233. break;
  234. case "2":
  235. uni.navigateTo({
  236. url: "/otherPages/authentication/serve/record"
  237. })
  238. break;
  239. case "3":
  240. uni.navigateTo({
  241. url: "/otherPages/authentication/connectAddress/index"
  242. })
  243. break;
  244. case "4":
  245. break;
  246. case "5":
  247. uni.navigateTo({
  248. url: "/otherPages/orderTakingManage/evaluate/index"
  249. })
  250. break;
  251. }
  252. }
  253. const handleOpen = () => {
  254. show.value = false
  255. }
  256. const handleBc = () => {
  257. uni.navigateTo({
  258. url: "/otherPages/authentication/list/index"
  259. })
  260. }
  261. </script>
  262. <style scoped lang="scss">
  263. @import "index";
  264. </style>