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

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