Browse Source

feat:(merchant)关系审核页面,接口已调通,界面还需要优化

Jake 3 months ago
parent
commit
28b22a2ae7

+ 1 - 1
packages/app/src/store/user.ts

@@ -1,5 +1,5 @@
 import { defineStore } from 'pinia'
-import { ref,computed} from 'vue'
+import { ref, computed } from 'vue'
 
 const initState = { nickname: '', avatar: '' }
 

+ 126 - 31
packages/merchant/src/components/data-form.vue

@@ -2,28 +2,46 @@
 import WdButton from 'wot-design-uni/components/wd-button/wd-button.vue'
 import WdInput from 'wot-design-uni/components/wd-input/wd-input.vue'
 import WdPicker from 'wot-design-uni/components/wd-picker/wd-picker.vue'
+import { ConfigProviderThemeVars } from 'wot-design-uni'
 
 const modelValue = defineModel({
   type: Object,
   default: () => ({}),
 })
-defineProps({
-  schema: {
-    type: Object as PropType<{
-      [key: string | symbol]: { type: 'TextField' | 'Submit' | string; label?: string; props?: any }
-    }>,
-    required: true,
-    default: () => ({}),
-  },
-  direction: {
-    type: String as PropType<'horizontal' | 'vertical'>,
-    default: 'vertical',
-  },
-})
+// defineProps({
+//   schema: {
+//     type: Object as PropType<{
+//       [key: string | symbol]: { type: 'TextField' | 'Submit' | string; label?: string; props?: any }
+//     }>,
+//     required: true,
+//     default: () => ({}),
+//   },
+//   direction: {
+//     type: String as PropType<'horizontal' | 'vertical'>,
+//     default: 'vertical',
+//   },
+// })
+withDefaults(
+  defineProps<{
+    schema: {
+      [key: symbol]: {
+        type: 'TextField' | 'Select' | 'Radio' | 'Submit'
+        label?: string
+        existing?: boolean
+        props?: any
+      }
+    }
+    direction?: 'horizontal' | 'vertical'
+  }>(),
+  { direction: 'vertical' },
+)
+const emits = defineEmits(['submit'])
+const form = ref()
 const types = {
   TextField: WdInput,
   Submit: WdButton,
   Select: WdPicker,
+  // Radio: WdRadioGroup,
 }
 const defaultProps = {
   TextField: {
@@ -37,42 +55,119 @@ const defaultProps = {
     block: true,
   },
 }
-// const
+const verticalDefaultProps = {
+  TextField: {
+    noBorder: true,
+    style: {},
+    customClass: 'rounded border border-[#e1e1e1] border-solid p-1',
+    placeholder: ' ',
+  },
+  Submit: {
+    customClass: 'w-full! rounded-lg! my-4!',
+    block: true,
+  },
+}
+const horizontalDefaultProps = {
+  TextField: {
+    customClass: 'text-red!',
+    placeholderClass: 'text-black/30',
+  },
+  Select: {
+    customClass: 'text-black/30! border-b-1 border-b-[#e1e1e1] border-b-solid',
+  },
+  Radio: {
+    customClass: 'my--4!',
+  },
+}
+const themeVars: ConfigProviderThemeVars = {
+  cellPadding: '0',
+  cellWrapperPadding: '10rpx',
+  radioButtonRadius: '8rpx',
+  radioButtonBg: 'transparent',
+}
+const submit = () => {
+  emits('submit', modelValue)
+}
+const validate = (): Promise<{ valid: boolean; errors: any[] }> => form.value?.validate()
+defineExpose({
+  validate,
+})
 </script>
 <template>
-  <wd-form ref="form" :model="modelValue">
-    <wd-cell-group border>
+  <wd-config-provider :theme-vars="themeVars">
+    <wd-form ref="form" :model="modelValue" >
       <template
-        v-for="([prop, { type, label, props }], index) in Object.entries(schema)"
+        v-for="([prop, { type, label, existing, props }], index) in Object.entries(schema)"
         :key="index"
       >
-        <div class="grid mb-4">
+        <div
+          v-if="existing ?? true"
+          class="grid mb-4"
+          :class="[direction === 'horizontal' ? 'items-center' : '']"
+          :style="
+            direction === 'horizontal'
+              ? { 'grid-template-columns': `${props?.labelWidth} auto` }
+              : {}
+          "
+        >
           <label
-            v-if="type !== 'Submit' && direction === 'vertical'"
-            class="text-black/40 text-sm font-normal font-['PingFang_SC'] leading-relaxed mb-1"
+            v-if="type !== 'Submit'"
+            class="text-sm font-normal leading-relaxed"
+            :class="[direction === 'horizontal' ? 'text-black/60' : 'mb-1 text-black/40']"
             :for="prop"
           >
             {{ label || prop }}
           </label>
-          <!-- #ifdef H5 -->
-          <component :is="types[type]" :name="prop" v-bind="defaultProps[type]">
-            <span v-if="type === 'Submit'">提交</span>
-          </component>
-          <!-- #endif -->
-          <!-- #ifdef MP-WEIXIN -->
           <wd-input
             v-if="type === 'TextField'"
-            v-bind="{ label, ...props }"
+            v-bind="{
+              ...(direction === 'vertical'
+                ? verticalDefaultProps[type]
+                : horizontalDefaultProps[type]),
+              ...props,
+            }"
             v-model="modelValue[prop]"
           ></wd-input>
           <wd-picker
             v-if="type === 'Select'"
-            v-bind="{ label, ...props }"
+            v-bind="{
+              ...(direction === 'vertical'
+                ? verticalDefaultProps[type]
+                : horizontalDefaultProps[type]),
+              cell: false,
+              ...props,
+            }"
             v-model="modelValue[prop]"
           ></wd-picker>
-          <!-- #endif -->
+          <wd-radio-group
+            v-if="type === 'Radio'"
+            v-bind="{
+              ...(direction === 'vertical'
+                ? verticalDefaultProps[type]
+                : horizontalDefaultProps[type]),
+              ...props,
+              cell: true,
+              shape: 'button',
+            }"
+            v-model="modelValue[prop]"
+          >
+            <template v-for="{ label, value } of props.columns" :key="value">
+              <wd-radio :value="value">{{ label }}</wd-radio>
+            </template>
+          </wd-radio-group>
+          <wd-button
+            v-if="type === 'Submit'"
+            v-bind="{
+              ...(direction === 'vertical' ? verticalDefaultProps[type] : {}),
+              ...props,
+              formType: 'submit',
+            }"
+            @click="submit"
+          >
+            <span v-if="type === 'Submit'">提交</span>
+          </wd-button>
         </div>
       </template>
-    </wd-cell-group>
-  </wd-form>
+    </wd-form>
+  </wd-config-provider>
 </template>

+ 7 - 0
packages/merchant/src/core/libs/requests.ts

@@ -175,6 +175,7 @@ export const createCircleUpvote = (data: { circleId: number; userId: number; use
   httpPost('/app-api/member/circle-upvote/create', data)
 export const cancelCircleUpvote = (query: { id: string }) =>
   httpGet('/app-apimember/circle-upvote/delete', query)
+
 export const createCircleReview = (
   data: Partial<{
     circleId: string
@@ -218,6 +219,12 @@ export const getCircleReviewUpvotes = (query: { circleId: string; reviewId?: str
   httpGet('/app-api/member/circle-review-upvote/page', query)
 export const getReviewReplay = (query: { id: string }) =>
   httpGet('/app-api/member/circle-review/getReviewReplay', query)
+// 获取设计师列表
+export const getDesignerList = (query: { brokerId: string; pageNo: number; pageSize: any }) =>
+  httpGet('/app-api/member/report-info/pageStylistByBrokerId', query)
+// 添加关系报备
+export const createReportInfo = (data) => httpPost<any>('/app-api/member/report-info/create', data)
+
 export const getTasks = (query) =>
   httpGet<{
     list: {

+ 1 - 1
packages/merchant/src/layouts/tabbar.vue

@@ -17,7 +17,7 @@ const userStore = useUserStore()
 const { userInfo, isChannel, isMerchant } = storeToRefs(userStore)
 const publishState = ref(false)
 const items = computed(() => {
-  if (isChannel.value) {
+  if (isChannel?.value) {
     return [
       {
         title: '首页',

+ 8 - 0
packages/merchant/src/pages.json

@@ -109,6 +109,14 @@
       }
     },
     {
+      "path": "pages/home/merchant/add-reporting-information",
+      "type": "page",
+      "style": {
+        "navigationBarTitleText": "添加关系报备",
+        "navigationBarBackgroundColor": "#fff"
+      }
+    },
+    {
       "path": "pages/home/merchant/mine",
       "type": "page",
       "layout": "tabbar",

+ 4 - 1
packages/merchant/src/pages/home/index.vue

@@ -127,7 +127,9 @@ const handle2Settlement = () => {
   router.push(
     `/pages/home/merchant/settlement?orderAmount=${orderAmount.value}&pointsAmount=${pointsAmount.value}`,
   )
-
+}
+const toAddReporting = () => {
+  uni.navigateTo({ url: '/pages/home/merchant/add-reporting-information' })
 }
 onShow(async () => {})
 onLoad(() => {
@@ -154,6 +156,7 @@ onShareAppMessage(() => ({}))
       <wd-navbar custom-class="bg-transparent!" safe-area-inset-top :bordered="false">
         <template #left>
           <div
+            @click="toAddReporting"
             class="ml-1 text-center text-white text-lg font-normal font-['PingFang_SC'] leading-relaxed"
           >
             今日待办

+ 145 - 0
packages/merchant/src/pages/home/merchant/add-reporting-information.vue

@@ -0,0 +1,145 @@
+<route lang="json">
+{ "style": { "navigationBarTitleText": "添加关系报备", "navigationBarBackgroundColor": "#fff" } }
+</route>
+<script setup lang="ts">
+import DataForm from '../../../components/data-form.vue'
+import {createReportInfo, getDesignerList} from '@/core/libs/requests'
+import { useUserStore } from '@/store'
+import { storeToRefs } from 'pinia'
+
+const userStore = useUserStore()
+const { userInfo } = storeToRefs(userStore)
+const formData = ref<any>({})
+const designerList = ref([])
+const stylistIdName = ref('')
+const merchantSchema = ref({
+  stylistId: {
+    type: 'Select',
+    label: '设计师',
+    props: {
+      labelWidth: '126rpx',
+      placeholder: '请选择通过哪个渠道入驻的筑巢荟',
+      columns: [],
+      // disabled: userAuthInfo.value != null,
+      'onUpdate:modelValue': (value) => {
+        // console.log(value),
+        designerList.value.forEach((item: any) => {
+          if (item.id === value) {
+            stylistIdName.value = item.name
+          }
+          console.log(stylistIdName.value)
+
+        })
+      },
+    },
+  },
+  arrivalTime: {
+    type: 'TextField',
+    label: '到店时间',
+    props: {
+      labelWidth: '126rpx',
+      placeholder: '请选择到店时间',
+      // disabled: userAuthInfo.value != null,
+    },
+  },
+  shopName: {
+    type: 'TextField',
+    label: '店面名称',
+    existing: true,
+    props: {
+      labelWidth: '126rpx',
+      placeholder: '店面名称',
+      // disabled: userAuthInfo.value != null,
+    },
+  },
+  receptionist: {
+    type: 'TextField',
+    label: '接待人员',
+    props: {
+      labelWidth: '126rpx',
+      placeholder: '请输入接待人员',
+    },
+  },
+  contactNumber: {
+    type: 'TextField',
+    label: '联系电话',
+    props: {
+      labelWidth: '126rpx',
+      placeholder: '请输入联系电话',
+    },
+  },
+})
+const customerSchema = ref({
+  customerName: {
+    type: 'TextField',
+    label: '客户姓名',
+    props: {
+      labelWidth: '126rpx',
+      placeholder: '请输入客户姓名',
+    },
+  },
+  customerPhoneNumbe: {
+    type: 'TextField',
+    label: '客户电话',
+    props: {
+      labelWidth: '126rpx',
+      placeholder: '请输入客户电话',
+    },
+  },
+  customerAddress: {
+    type: 'TextField',
+    label: '客户地址',
+    props: {
+      labelWidth: '126rpx',
+      placeholder: '请输入客户地址',
+    },
+  },
+})
+const SubmitClick = async () => {
+  console.log(formData.value)
+  formData.value.arrivalTime = 1730292340000
+  formData.value.stylistName = stylistIdName.value
+  uni.showLoading()
+  const {code, msg} = await createReportInfo(formData.value)
+  uni.hideLoading()
+  if (code === 0) {
+    uni.showToast({
+      title: '上报成功',
+      icon: 'none',
+    })
+  }
+}
+const getDesInfo = async () => {
+  const res = await getDesignerList({ brokerId: userInfo.value.userId, pageNo: 1, pageSize: -1 })
+  designerList.value = res.data.list
+  console.log(res.data.list)
+
+  merchantSchema.value.stylistId.props.columns = res.data.list.map(item => ({value: item.id, label: item.name}))
+}
+
+onMounted(async () => {
+  getDesInfo()
+})
+</script>
+
+<template>
+  <div class="flex-grow bg-white flex flex-col p-2.5 gap-3">
+    <div>
+      <data-form :schema="merchantSchema" :direction="'horizontal'" v-model="formData" />
+    </div>
+    <div>客户信息</div>
+    <div class="mt-1">
+      <data-form :schema="customerSchema" :direction="'horizontal'" v-model="formData" />
+    </div>
+    <div class="flex-1"></div>
+    <div><wd-button block :round="false" @click="SubmitClick">提交</wd-button></div>
+  </div>
+</template>
+
+<style scoped lang="scss">
+.pageclass {
+  display: flex;
+  flex-direction: column;
+  justify-content: space-between;
+}
+</style>

+ 1 - 0
packages/merchant/src/pages/home/merchant/mine.vue

@@ -6,6 +6,7 @@ style:
 </route>
 <script lang="ts" setup>
 import { desinTopBg } from '@designer-hub/assets/src/svgs'
+
 </script>
 
 <template>

+ 1 - 0
packages/merchant/src/types/uni-pages.d.ts

@@ -11,6 +11,7 @@ interface NavigateToOptions {
        "/pages/home/index" |
        "/pages/mine/index" |
        "/pages/designer/points_details/index" |
+       "/pages/home/merchant/add-reporting-information" |
        "/pages/home/merchant/mine" |
        "/pages/home/merchant/settlement" |
        "/pages/home/tasks/index" |

File diff suppressed because it is too large
+ 2926 - 627
pnpm-lock.yaml


Some files were not shown because too many files changed in this diff