ソースを参照

refactor(merchant): 重构商户端代码

- 修改环境变量配置
- 优化首页布局和逻辑
- 美化个人中心页面
- 完善商家设置页面
- 统一枚举类型定义
- 调整二维码业务类型枚举位置
- 优化网络图片枚举
EvilDragon 4 ヶ月 前
コミット
8effe2a2ce

+ 2 - 2
packages/app/env/.env.development

@@ -5,14 +5,14 @@ VITE_DELETE_CONSOLE = false
 # 是否开启sourcemap
 VITE_SHOW_SOURCEMAP = true
 
-VITE_SERVER_BASEURL = 'https://www.zhuchaohui.com'
+# VITE_SERVER_BASEURL = 'https://www.zhuchaohui.com'
 # VITE_SERVER_BASEURL = 'http://39.106.91.179:48080'
 # VITE_SERVER_BASEURL = 'http://192.168.2.34:48080'
 # 王超
 # VITE_SERVER_BASEURL = 'http://192.168.2.39:48080'
 # VITE_SERVER_BASEURL = 'http://192.168.0.157:48080'
 # 刘岁成
-# VITE_SERVER_BASEURL = 'http://192.168.2.38:48080'
+VITE_SERVER_BASEURL = 'http://192.168.2.38:48080'
 # 赵要军
 # VITE_SERVER_BASEURL = 'http://192.168.2.41:48080'
 # 姚逊涛

+ 2 - 2
packages/merchant/src/components/page-helper.vue

@@ -1,7 +1,7 @@
 <script setup lang="ts" generic="S extends Object, T extends { list: S[] }">
 import useRequest from '../hooks/useRequest'
-import { ref, Ref, watch, onMounted } from 'vue'
-import { NetImages } from '@designer-hub/app/src/core/libs/net-images'
+import { Ref, watch, onMounted } from 'vue'
+import { NetImages } from '../core/libs/enums'
 
 const props = defineProps<{
   request: (query: any) => Promise<IResData<T>>

+ 19 - 0
packages/merchant/src/core/libs/enums.ts

@@ -0,0 +1,19 @@
+export enum QrCodeBusinessType {
+  /**
+   * 积分结账
+   */
+  PointsCheckout = 'PC',
+  /**
+   * 到店核销
+   */
+  InStoreWriteOff = 'ISWO',
+}
+export enum NetImages {
+  'default' = 'https://cdn.jsdelivr.net/gh/yangyang-yangyang/yangyang-yangyang.github.io@master/images/default.png',
+  'avatar' = 'https://cdn.jsdelivr.net/gh/yangyang-yangyang/yangyang-yangyang.github.io@master/images/avatar.png',
+  'NotContent' = 'https://image.zhuchaohui.com/zhucaohui/3819d411440c23cc9e4f4bd3a520325386d7f038ed6dfa7c2ba076bd5110d2d2.png',
+  'DesigerHomepageDefaultBg' = 'https://image.zhuchaohui.com/zhucaohui/58dcb982d2957c5578478abbf000936efe9d11c96c5af4d457177cf5d90a9d39.png',
+  ConsultDefaultBg = 'https://image.zhuchaohui.com/zhucaohui/f1942e62d1b1adc23f37de705570e22d098da319e10c8a448dc49e594d4bee3a.png',
+  StudyTourItemBg = 'https://image.zhuchaohui.com/zhucaohui/254b7ea7fdecaba8e318a7f50e292d036cafe49904fc7fc160a5477ce921e261.png',
+  DefaultAvatar = 'https://image.zhuchaohui.com/zhucaohui/0b57771c2fbe60157e592a5b0e51a2b2b6c5263300663ad33efd55b235a2402a.png',
+}

+ 12 - 14
packages/merchant/src/pages/home/index.vue

@@ -19,7 +19,7 @@ import { useUserStore } from '../../store'
 import { storeToRefs } from 'pinia'
 import { qrCodeString2Object, requestToast } from '@designer-hub/app/src/core/utils/common'
 import { useRouter } from '@designer-hub/app/src/core/utils/router'
-import { QrCodeBusinessType } from '@designer-hub/app/src/core/libs/models'
+import { QrCodeBusinessType } from '../../core/libs/enums'
 
 defineOptions({
   name: 'Home',
@@ -119,10 +119,16 @@ const handleScanning = async () => {
     successTitle: '验券成功',
   })
 }
-onShow(async () => {
-  // await run()
-  console.log(circlesData.value)
-})
+const handle2Settlement = () => {
+  if ((orderAmount.value ?? '') === '') {
+    uni.showToast({ title: '请输入金额', icon: 'none', duration: 5000 })
+    return
+  }
+  router.push(
+    `/pages/home/merchant/settlement?orderAmount=${orderAmount.value}&pointsAmount=${pointsAmount.value}`,
+  )
+}
+onShow(async () => {})
 onLoad(() => {
   console.log(isLogined.value)
   if (!isLogined.value) {
@@ -277,15 +283,7 @@ onShareAppMessage(() => ({}))
           </div>
         </div>
         <div class="w-full mt-[45px]">
-          <wd-button
-            block
-            :round="false"
-            @click="
-              router.push(
-                `/pages/home/merchant/settlement?orderAmount=${orderAmount}&pointsAmount=${pointsAmount}`,
-              )
-            "
-          >
+          <wd-button block :round="false" @click="handle2Settlement">
             <div
               class="text-center text-white text-base font-normal font-['PingFang_SC'] leading-normal"
             >

+ 1 - 1
packages/merchant/src/pages/home/merchant/settlement.vue

@@ -5,7 +5,7 @@
 import { ref } from 'vue'
 import UQRCode from 'uqrcodejs'
 import { toQrCodeString } from '@designer-hub/app/src/core/utils/common'
-import { QrCodeBusinessType } from '@designer-hub/app/src/core/libs/models'
+import { QrCodeBusinessType } from '../../../core/libs/enums'
 import { getVendorAppInfo } from '../../../core/libs/requests'
 
 const orderAmount = ref()

+ 29 - 27
packages/merchant/src/pages/mine/index.vue

@@ -256,40 +256,42 @@ onPageScroll(({ scrollTop }: { scrollTop: number }) => {
             <template #default="{ source }">
               <div class="flex flex-col gap-4">
                 <template v-for="(it, i) in source.list" :key="i">
-                  <div
-                    class="bg-white rounded-2xl p-[16px] flex flex-col"
-                    @click="router.push(`/pages/mine/merchant/orders/detail/index?id=${it.id}`)"
-                  >
+                  <Card custom-class="py-4">
                     <div
-                      class="text-black/90 text-sm font-normal font-['PingFang_SC'] leading-normal"
+                      class="bg-white rounded-2xl flex flex-col"
+                      @click="router.push(`/pages/mine/merchant/orders/detail/index?id=${it.id}`)"
                     >
-                      完成时间:
-                      {{ dayjs(it.completeTime).format('YYYY-MM-DD hh:mm') }}
-                    </div>
-
-                    <div class="flex mt-[19px] items-center">
-                      <div class="w-[86px] h-[86px] bg-[#f6f6f6] rounded-[10px]">
-                        <wd-img width="100%" height="100%" :src="it.orderImgUrl"></wd-img>
+                      <div
+                        class="text-black/90 text-sm font-normal font-['PingFang_SC'] leading-normal"
+                      >
+                        完成时间:
+                        {{ dayjs(it.completeTime).format('YYYY-MM-DD hh:mm') }}
                       </div>
-                      <div class="ml-[16px]">
-                        <div
-                          class="text-black text-base font-normal font-['PingFang_SC'] leading-normal"
-                        >
-                          {{ it.projectName }}
-                        </div>
-                        <div
-                          class="text-left text-black/30 text-sm font-normal font-['PingFang_SC'] leading-normal"
-                        >
-                          数量x{{ it.orderQuantity }}
+
+                      <div class="flex mt-[19px] items-center">
+                        <div class="w-[86px] h-[86px] bg-[#f6f6f6] rounded-[10px] overflow-hidden">
+                          <wd-img width="100%" height="100%" :src="it.orderImgUrl"></wd-img>
                         </div>
-                        <div
-                          class="text-left text-black/30 text-sm font-normal font-['PingFang_SC'] leading-normal"
-                        >
-                          {{ it.points }}积分
+                        <div class="ml-[16px]">
+                          <div
+                            class="text-black text-base font-normal font-['PingFang_SC'] leading-normal"
+                          >
+                            {{ it.projectName }}
+                          </div>
+                          <div
+                            class="text-left text-black/30 text-sm font-normal font-['PingFang_SC'] leading-normal"
+                          >
+                            数量x{{ it.orderQuantity }}
+                          </div>
+                          <div
+                            class="text-left text-black/30 text-sm font-normal font-['PingFang_SC'] leading-normal"
+                          >
+                            {{ it.points }}积分
+                          </div>
                         </div>
                       </div>
                     </div>
-                  </div>
+                  </Card>
                 </template>
               </div>
             </template>

+ 18 - 12
packages/merchant/src/pages/mine/merchant/merchant_settings.vue

@@ -7,16 +7,19 @@ style:
 import { useUserStore } from '../../../store'
 import { storeToRefs } from 'pinia'
 
-import { desinTopBg, rightArrowIcon } from '@designer-hub/assets/src/svgs'
-import { log } from 'console'
-const collapseValue = ref<string[]>(['item1'])
+import { rightArrowIcon } from '@designer-hub/assets/src/svgs'
+import { getVendorAppInfo } from '../../../core/libs/requests'
+import SectionHeading from '@designer-hub/app/src/components/section-heading.vue'
 const userStore = useUserStore()
 const { isLogined, userInfo } = storeToRefs(userStore)
+const { data, run: setData } = useRequest(() => getVendorAppInfo())
 const logout = () => {
-  console.log('logout')
-  userStore.userInfo = {}
+  userStore.clearUserInfo()
   uni.reLaunch({ url: '/pages/login/index' })
 }
+onMounted(async () => {
+  await setData()
+})
 </script>
 
 <template>
@@ -24,14 +27,14 @@ const logout = () => {
     <div class="flex-1">
       <div class="flex justify-between items-center mb-[30px]">
         <div class="text-black/40 text-sm font-normal font-['PingFang_SC'] leading-none">头像</div>
-        <img class="w-7 h-7 rounded-full" src="https://via.placeholder.com/28x28" />
+        <wd-img width="28" height="28" class="w-7 h-7 rounded-full" :src="data?.avatar" />
       </div>
       <div class="flex justify-between items-center mb-[30px]">
         <div class="text-black/40 text-sm font-normal font-['PingFang_SC'] leading-none">名称</div>
         <div
           class="text-right text-[#999999] text-sm font-normal font-['PingFang_SC'] leading-none"
         >
-          GELATO
+          {{ data?.vendorName }}
         </div>
       </div>
       <div class="flex justify-between items-center mb-[30px]">
@@ -39,7 +42,7 @@ const logout = () => {
         <div
           class="text-right text-[#999999] text-sm font-normal font-['PingFang_SC'] leading-none"
         >
-          1254022
+          {{ data?.id }}
         </div>
       </div>
       <div class="flex justify-between items-center mb-[30px]">
@@ -49,7 +52,8 @@ const logout = () => {
         <div
           class="text-right text-[#999999] text-sm font-normal font-['PingFang_SC'] leading-none"
         >
-          李晓东
+          <!-- 李晓东 -->
+          {{ data?.contactName }}
         </div>
       </div>
       <div class="flex justify-between items-center mb-[30px]">
@@ -59,15 +63,17 @@ const logout = () => {
         <div
           class="text-right text-[#999999] text-sm font-normal font-['PingFang_SC'] leading-none"
         >
-          132****1452
+          <!-- 132****1452 -->
+          {{ data?.mobile }}
         </div>
       </div>
-      <div class="flex justify-between items-center">
+      <!-- <div class="flex justify-between items-center">
         <div class="text-black/40 text-sm font-normal font-['PingFang_SC'] leading-none">
           修改密码
         </div>
         <wd-img width="15px" height="15px" :src="rightArrowIcon"></wd-img>
-      </div>
+      </div> -->
+      <SectionHeading title="修改密码" size="sm" end-arrow></SectionHeading>
     </div>
     <div class="w-full mt-[50px]">
       <wd-button block :round="false" @click="logout">