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

360 lines
7.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="handleSubmit"></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="handleSubmit">
  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="handleSubmit">
  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" ></popupTypeSelect>
  67. <popupServeSelect ref="popupServeSelectRef" v-model="form.serve" :options="serveOptions" ></popupServeSelect>
  68. </view>
  69. </template>
  70. <script setup>
  71. import { ref, reactive, computed } from "vue";
  72. import { onShow } from '@dcloudio/uni-app'
  73. import { ossUpload } from '@/utils/oss-upload/oss/index.js'
  74. import DForm from "@/components/dForm/index.vue"
  75. import popupTypeSelect from "./popupTypeSelect.vue";
  76. import popupServeSelect from "./popupServeSelect.vue";
  77. const form = reactive({
  78. headImage: null,
  79. type: [],
  80. serve: [],
  81. })
  82. const onChooseAvatar = (res) => {
  83. ossUpload(res.target.avatarUrl)
  84. .then(url => {
  85. form.headImage = url
  86. })
  87. }
  88. const baseInfoRef = ref()
  89. const displayInfoRef = ref()
  90. const serveInfoRef = ref()
  91. const state = reactive({
  92. baseInfoList: [{
  93. type: "input",
  94. label: "昵称",
  95. key: "name",
  96. placeholder: "请输入",
  97. },
  98. {
  99. type: "input",
  100. label: "手机号",
  101. key: "idCard",
  102. placeholder: "请输入",
  103. },
  104. {
  105. type: "select",
  106. label: "性别",
  107. key: "sex",
  108. placeholder: "请选择",
  109. options: [{
  110. name: "男"
  111. },
  112. {
  113. name: "女"
  114. }
  115. ]
  116. }
  117. ],
  118. displayInfoList: [{
  119. type: "input",
  120. label: "个人简介",
  121. key: "jianjie",
  122. placeholder: "请输入",
  123. },
  124. {
  125. type: "input",
  126. label: "养宠经验",
  127. unit: "年",
  128. key: "jingyan",
  129. placeholder: "请输入",
  130. },
  131. {
  132. type: "custom",
  133. label: "服务记录",
  134. key: "jilu",
  135. placeholder: "请选择",
  136. options: [{
  137. name: "男"
  138. },
  139. {
  140. name: "女"
  141. }
  142. ]
  143. }
  144. ],
  145. serveInfoList: [{
  146. type: "custom",
  147. label: "服务宠物类型",
  148. key: "type",
  149. placeholder: "请选择",
  150. },
  151. {
  152. type: "input",
  153. label: "基础服务",
  154. unit: "年",
  155. key: "base",
  156. placeholder: "宠物喂养上门遛狗",
  157. },
  158. {
  159. type: "custom",
  160. label: "增值服务",
  161. key: "zenz",
  162. placeholder: "请选择",
  163. }
  164. ],
  165. })
  166. onShow(() => {
  167. // todo: fetch data and init data
  168. })
  169. const handleSubmit = () => {
  170. // todo
  171. }
  172. const jumpToServeRecord = () => {
  173. uni.navigateTo({
  174. url: "/otherPages/authentication/serve/record"
  175. })
  176. }
  177. const popupTypeSelectRef = ref()
  178. const openTypeSelectPopup = () => {
  179. popupTypeSelectRef.value.open()
  180. }
  181. const typeDesc = computed(() => {
  182. const typeCodes = form.type
  183. if (!typeCodes.length) {
  184. return '请选择'
  185. }
  186. let descArr = typeCodes.reduce((arr, item) => {
  187. switch(item) {
  188. case 'cat':
  189. arr.push('猫咪')
  190. break
  191. case 'dog':
  192. arr.push('狗狗')
  193. break
  194. case 'special-pet':
  195. arr.push('异宠')
  196. break
  197. default:
  198. break
  199. }
  200. return arr
  201. }, [])
  202. return descArr.join('、')
  203. })
  204. const popupServeSelectRef = ref()
  205. const serveOptions = reactive([
  206. {
  207. title: '陪玩/遛狗',
  208. desc: '外出遛狗或者陪玩,10mins/次',
  209. value: 0,
  210. },
  211. {
  212. title: '一天多次',
  213. desc: '每额外上门一次,收取基础服务费用的80%',
  214. value: 1,
  215. },
  216. {
  217. title: '护理',
  218. desc: '清洁宠物耳道、眼部、鼻部以及梳毛,10mins/次',
  219. value: 2,
  220. },
  221. {
  222. title: '提前熟悉',
  223. desc: '提前上门熟悉,购买此服务支持免费更换伴宠师1次',
  224. value: 3,
  225. },
  226. {
  227. title: '清洁',
  228. desc: '清洗砂盆或其他区域卫生,15mins/次',
  229. value: 4,
  230. },
  231. {
  232. title: '喂药',
  233. desc: '将药品喂入宠物口中',
  234. value: 5,
  235. },
  236. {
  237. title: '上药',
  238. desc: '将药品放入宠物水粮、或者涂抹在皮肤外表',
  239. value: 6,
  240. },
  241. {
  242. title: '打针',
  243. desc: '兽医上门打针,自备药品',
  244. value: 7,
  245. },
  246. {
  247. title: '在线问诊',
  248. desc: '在线问诊在职兽医健康问题',
  249. value: 8,
  250. },
  251. {
  252. title: '线下体察',
  253. desc: '上门外表体查,给予宠物健康咨询',
  254. value: 9,
  255. },
  256. ])
  257. const openServeSelectPopup = () => {
  258. popupServeSelectRef.value.open()
  259. }
  260. const serveDesc = computed(() => {
  261. const serveCodes = form.serve
  262. if (!serveCodes.length) {
  263. return '请选择'
  264. }
  265. let descArr = serveCodes.reduce((arr, item) => {
  266. const desc = serveOptions.find(option => option.value === item)?.title
  267. arr.push(desc)
  268. return arr
  269. }, [])
  270. return descArr.join('、')
  271. })
  272. </script>
  273. <style lang="scss" scoped>
  274. .page {
  275. padding-top: 16rpx;
  276. .tip {
  277. background-color: rgba($color: #FFBF60, $alpha: 0.16);
  278. padding: 13rpx 22rpx;
  279. margin: 0 28rpx 37rpx 28rpx;
  280. .icon {
  281. margin-right: 15rpx;
  282. }
  283. }
  284. }
  285. .info {
  286. & + & {
  287. margin-top: 50rpx;
  288. }
  289. }
  290. .head {
  291. width: 165rpx;
  292. height: auto;
  293. margin-top: 28rpx;
  294. }
  295. .btn-avatar {
  296. border: none;
  297. padding: 0;
  298. }
  299. .title {
  300. font-size: 30rpx;
  301. font-weight: 700;
  302. display: flex;
  303. align-items: center;
  304. padding: 0 40rpx;
  305. &:before {
  306. display: inline-block;
  307. content: "";
  308. width: 10rpx;
  309. border-radius: 5rpx;
  310. height: 33rpx;
  311. background-color: #FFBF60;
  312. margin-right: 7rpx;
  313. }
  314. }
  315. .form {
  316. padding: 0 22rpx;
  317. :deep(.form-item){
  318. padding-left: 24rpx;
  319. padding-right: 30rpx;
  320. box-sizing: border-box;
  321. }
  322. }
  323. </style>