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

304 lines
6.3 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
3 months ago
3 months ago
3 months ago
3 months ago
  1. <template>
  2. <view class="page bg-fff">
  3. <view class="size-22 color-ffb flex-rowl tip">
  4. <up-icon class="icon" name="error-circle" color="#FFBF60" size="36rpx"></up-icon>
  5. <text>完善服务信息和接单状态后才可以开始接单哦</text>
  6. </view>
  7. <view class="info">
  8. <view class="title mt24">
  9. 基本资料
  10. </view>
  11. <view class="flex-colc">
  12. <button class="btn-avatar" :plain="true" :hairline="false" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
  13. <view class="flex-colc">
  14. <image class="head" :src="form.headImage" mode="widthFix"></image>
  15. <text class="size-28 color-999 mt10">点击更换头像</text>
  16. </view>
  17. </button>
  18. </view>
  19. <view class="form">
  20. <DForm ref="baseInfoRef" :list="state.baseInfoList" @input="fetchUpdate"></DForm>
  21. </view>
  22. </view>
  23. <view class="info">
  24. <view class="title mt24 flex-rowl">
  25. 展示信息
  26. <text class="size-22 color-ffb fw700">(重要)</text>
  27. </view>
  28. <view class="form">
  29. <DForm ref="displayInfoRef" :list="state.displayInfoList" @input="fetchUpdate">
  30. <!-- 服务记录 -->
  31. <template v-slot:jilu>
  32. <view class="flex-rowr" @click="jumpToServeRecord">
  33. <text>{{ `${0}` }}</text>
  34. <up-icon name="arrow-right" color="#999999" size="32rpx"></up-icon>
  35. </view>
  36. </template>
  37. </DForm>
  38. </view>
  39. </view>
  40. <view class="info">
  41. <view class="title mt24 flex-rowl">
  42. 服务资料
  43. </view>
  44. <view class="form">
  45. <DForm ref="serveInfoRef" :list="state.serveInfoList" @input="fetchUpdate">
  46. <!-- 服务宠物类型 -->
  47. <template v-slot:type>
  48. <view class="flex-rowr" @click="openTypeSelectPopup">
  49. <text>{{ typeDesc }}</text>
  50. <up-icon name="arrow-right" color="#999999" size="32rpx"></up-icon>
  51. </view>
  52. </template>
  53. <!-- 增值服务 -->
  54. <template v-slot:zenz>
  55. <view class="flex-rowr" @click="openServeSelectPopup">
  56. <text>{{ serveDesc }}</text>
  57. <up-icon name="arrow-right" color="#999999" size="32rpx"></up-icon>
  58. </view>
  59. </template>
  60. </DForm>
  61. </view>
  62. </view>
  63. <view class="size-24 color-ffb flex-rowc mt32 pb28">
  64. 伴宠师查看服务酬劳服务时长等规则
  65. </view>
  66. <popupTypeSelect ref="popupTypeSelectRef" v-model="form.type" @confirm="fetchUpdate" ></popupTypeSelect>
  67. <popupServeSelect ref="popupServeSelectRef" v-model="form.serve" @confirm="fetchUpdate" ></popupServeSelect>
  68. </view>
  69. </template>
  70. <script setup>
  71. import { ref, reactive, computed } from "vue";
  72. import { useStore } from 'vuex'
  73. import { onShow } from '@dcloudio/uni-app'
  74. import { ossUpload } from '@/utils/oss-upload/oss/index.js'
  75. import DForm from "@/components/dForm/index.vue"
  76. import popupTypeSelect from "./popupTypeSelect.vue";
  77. import popupServeSelect from "./popupServeSelect.vue";
  78. const store = useStore()
  79. const fetchUpdate = () => {
  80. // todo
  81. }
  82. const form = reactive({
  83. headImage: null,
  84. type: [],
  85. serve: [],
  86. })
  87. const onChooseAvatar = (res) => {
  88. ossUpload(res.target.avatarUrl)
  89. .then(url => {
  90. form.headImage = url
  91. fetchUpdate()
  92. })
  93. }
  94. const baseInfoRef = ref()
  95. const displayInfoRef = ref()
  96. const serveInfoRef = ref()
  97. const state = reactive({
  98. baseInfoList: [{
  99. type: "input",
  100. label: "昵称",
  101. key: "name",
  102. placeholder: "请输入",
  103. },
  104. {
  105. type: "input",
  106. label: "手机号",
  107. key: "idCard",
  108. placeholder: "请输入",
  109. },
  110. {
  111. type: "select",
  112. label: "性别",
  113. key: "sex",
  114. placeholder: "请选择",
  115. options: [{
  116. name: "男"
  117. },
  118. {
  119. name: "女"
  120. }
  121. ]
  122. }
  123. ],
  124. displayInfoList: [{
  125. type: "input",
  126. label: "个人简介",
  127. key: "jianjie",
  128. placeholder: "请输入",
  129. },
  130. {
  131. type: "input",
  132. label: "养宠经验",
  133. unit: "年",
  134. key: "jingyan",
  135. placeholder: "请输入",
  136. },
  137. {
  138. type: "custom",
  139. label: "服务记录",
  140. key: "jilu",
  141. placeholder: "请选择",
  142. options: [{
  143. name: "男"
  144. },
  145. {
  146. name: "女"
  147. }
  148. ]
  149. }
  150. ],
  151. serveInfoList: [{
  152. type: "custom",
  153. label: "服务宠物类型",
  154. key: "type",
  155. placeholder: "请选择",
  156. },
  157. {
  158. type: "input",
  159. label: "基础服务",
  160. key: "base",
  161. placeholder: "宠物喂养上门遛狗",
  162. },
  163. {
  164. type: "custom",
  165. label: "增值服务",
  166. key: "zenz",
  167. placeholder: "请选择",
  168. }
  169. ],
  170. })
  171. const jumpToServeRecord = () => {
  172. uni.navigateTo({
  173. url: "/otherPages/authentication/serve/record"
  174. })
  175. }
  176. const popupTypeSelectRef = ref()
  177. const openTypeSelectPopup = () => {
  178. popupTypeSelectRef.value.open()
  179. }
  180. const petTypeOptions = computed(() => {
  181. return store.getters.petTypeOptions
  182. })
  183. const typeDesc = computed(() => {
  184. const typeIds = form.type
  185. if (!typeIds.length) {
  186. return '请选择'
  187. }
  188. let descArr = typeIds.map(typeId => {
  189. return petTypeOptions.value.find(item => item.id === typeId).title
  190. })
  191. return descArr.join('、')
  192. })
  193. const popupServeSelectRef = ref()
  194. const increaseServiceOptions = computed(() => {
  195. return store.getters.increaseServiceOptions
  196. })
  197. const openServeSelectPopup = () => {
  198. popupServeSelectRef.value.open()
  199. }
  200. const serveDesc = computed(() => {
  201. const serveIds = form.serve
  202. if (!serveIds.length) {
  203. return '请选择'
  204. }
  205. let descArr = serveIds.map(serveId => {
  206. return increaseServiceOptions.value.find(option => option.id === serveId)?.title
  207. })
  208. return descArr.join('、')
  209. })
  210. onShow(() => {
  211. store.dispatch('fetchPetTypeOptions')
  212. store.dispatch('fetchIncreaseServiceOptions')
  213. // todo: fetch data and init data
  214. })
  215. </script>
  216. <style lang="scss" scoped>
  217. .page {
  218. padding-top: 16rpx;
  219. .tip {
  220. background-color: rgba($color: #FFBF60, $alpha: 0.16);
  221. padding: 13rpx 22rpx;
  222. margin: 0 28rpx 37rpx 28rpx;
  223. .icon {
  224. margin-right: 15rpx;
  225. }
  226. }
  227. }
  228. .info {
  229. & + & {
  230. margin-top: 50rpx;
  231. }
  232. }
  233. .head {
  234. width: 165rpx;
  235. height: auto;
  236. margin-top: 28rpx;
  237. }
  238. .btn-avatar {
  239. border: none;
  240. padding: 0;
  241. }
  242. .title {
  243. font-size: 30rpx;
  244. font-weight: 700;
  245. display: flex;
  246. align-items: center;
  247. padding: 0 40rpx;
  248. &:before {
  249. display: inline-block;
  250. content: "";
  251. width: 10rpx;
  252. border-radius: 5rpx;
  253. height: 33rpx;
  254. background-color: #FFBF60;
  255. margin-right: 7rpx;
  256. }
  257. }
  258. .form {
  259. padding: 0 22rpx;
  260. :deep(.form-item){
  261. padding-left: 24rpx;
  262. padding-right: 30rpx;
  263. box-sizing: border-box;
  264. }
  265. }
  266. </style>