Prechádzať zdrojové kódy

feat(agent): 添加设计师关注点功能并优化相关页面

- 新增创建设计师关注点的功能
- 优化优惠券选择逻辑和显示
- 更新设计师档案页面,增加关注点提交功能
- 修复订单页面的积分显示问题
EvilDragon 1 mesiac pred
rodič
commit
d9a5cc0022

+ 5 - 2
packages/app/src/pages/common/components/coupons-selector.vue

@@ -50,9 +50,12 @@ const handleSelect = (coupon: Coupon) => {
   //   modelValue.value = modelValue.value.filter(({ id }) => id !== coupon.id)
   // } else {
   //   modelValue.value = [...modelValue.value, coupon]
-  // }
   if (modelValue.value.length) {
-    modelValue.value.splice(0, 1, coupon)
+    if (modelValue.value.map(({ id }) => id).includes(coupon.id)) {
+      modelValue.value = modelValue.value.filter(({ id }) => id !== coupon.id)
+    } else {
+      modelValue.value.splice(0, 1, coupon)
+    }
   } else {
     modelValue.value.push(coupon)
   }

+ 3 - 5
packages/app/src/pages/home/mall/confirm-order/index.vue

@@ -30,7 +30,7 @@ const { userInfo } = storeToRefs(userStore)
 const show = ref(false)
 const { alert } = useMessage()
 const data = ref()
-const selectedCoupons = ref<Coupon[]>()
+const selectedCoupons = ref<Coupon[]>([])
 const requestData = computed(() => ({
   ...data.value,
   couponList:
@@ -103,8 +103,6 @@ const handleClose = () => {
 }
 onLoad(async (query: { data: string }) => {
   data.value = JSON.parse(query.data)
-  console.log(data.value)
-  setCoupons()
   await Promise.all([setCoupons(), setConfirmOrder()])
   // await setConfirmOrder()
 })
@@ -144,6 +142,7 @@ onLoad(async (query: { data: string }) => {
           size="sm"
         ></SectionHeading>
         <div @click="handleQ">
+          <!--          {{ selectedCoupons }}-->
           <SectionHeading
             title="优惠券"
             :end-text="`已选${selectedCoupons?.length || 0}张`"
@@ -169,7 +168,6 @@ onLoad(async (query: { data: string }) => {
                     class="text-sm font-normal font-['PingFang_SC'] leading-[10.18px]"
                     :class="coupons.length ? 'text-[#ef4343]' : 'text-black/40'"
                   >
-                    <!--                    选择优惠券-->
                     {{ coupons.length ? `${coupons.length}张可用` : '无可用' }}
                   </div>
                 </template>
@@ -187,7 +185,7 @@ onLoad(async (query: { data: string }) => {
         </div>
         <SectionHeading
           title="实付积分"
-          :end-text="confirmOrder?.totalsCurrPoints"
+          :end-text="String(confirmOrder?.totalsCurrPoints)"
           size="sm"
         ></SectionHeading>
       </div>

+ 1 - 1
packages/app/src/pages/mine/orders/index.vue

@@ -59,7 +59,7 @@ onShow(async () => {
                     <div
                       class="text-start text-black/60 text-sm font-normal font-['PingFang_SC'] leading-normal"
                     >
-                      {{ it.points }}积分
+                      {{ it.payPoints }}积分
                     </div>
                   </div>
                   <div>

+ 5 - 1
packages/merchant/src/core/libs/agent-requests.ts

@@ -276,7 +276,11 @@ export const deleteDesignerEvent = (id: number) =>
  */
 export const deleteStylistFamily = (id: number) =>
   httpDelete('/app-api/member/stylist-family/delete', { id })
-
+/**
+ * 创建设计师关注
+ */
+export const createFocus = (data: { userId: number; focus: string }) =>
+  httpPost('/app-api/member/stylist-extra-events/createFocus', data)
 /**
  * 获取设计师活动
  */

+ 17 - 0
packages/merchant/src/pages/agent/designer/archives/index.vue

@@ -9,6 +9,7 @@
 <script setup lang="ts">
 import {
   createAward,
+  createFocus,
   deleteAward,
   deleteStylistFamily,
   getAwards,
@@ -201,6 +202,13 @@ const handleDeleteFamilyInfo = async (item: DesignerFamilyInfo) => {
   })
   familyPageRef.value?.reload()
 }
+const handleSubmitFocus = async () => {
+  await requestToast(() => createFocus({ ...formData.value, userId: id.value }), {
+    success: true,
+    successTitle: '保存成功',
+  })
+  formData.value = {}
+}
 onLoad(async (query?: Record<string | 'id', any>) => {
   id.value = query?.id
 })
@@ -433,6 +441,15 @@ onShow(async () => {
               </template>
             </template>
           </ListHelperEvo>
+          <SectionHeading title="游学/活动关注点">
+            <template #append>
+              <wd-button type="text" @click="handleSubmitFocus">保存</wd-button>
+            </template>
+          </SectionHeading>
+          <DataForm
+            v-model="formData"
+            :schema="{ focus: { type: 'Textarea', hiddenLabel: true } }"
+          ></DataForm>
         </div>
       </template>
       <template v-if="tab === 'events'">