卖家端申请接口。人口

This commit is contained in:
李志鹏
2026-04-24 16:57:13 +08:00
parent 071930f257
commit e4fc51c574
9 changed files with 149 additions and 62 deletions

View File

@@ -7,6 +7,7 @@ import UserHabit from './userHabit/userHabit'
import Workspace from './workspace/workspace' import Workspace from './workspace/workspace'
import Guide from './guide/guide' import Guide from './guide/guide'
import adminPage from './adminPage/adminPage' import adminPage from './adminPage/adminPage'
import seller from './seller/index'
export interface RootState{ export interface RootState{
} }
@@ -41,5 +42,6 @@ export default createStore<RootState>({
Workspace, Workspace,
Guide, Guide,
adminPage, adminPage,
seller,
} }
}) })

6
src/store/seller/index.d.ts vendored Normal file
View File

@@ -0,0 +1,6 @@
export const ApplyStatus = {
Null: null,// 未申请过
Pending: 0,// 已提交, 待审核
Approved: 1,// 审核通过
Rejected: 2,// 审核拒绝
}

40
src/store/seller/index.ts Normal file
View File

@@ -0,0 +1,40 @@
import { Module } from 'vuex'
import { RootState } from '../index'
import i18n from "@/lang/index";
import { Https } from '@/tool/https'
import { ApplyStatus } from "./index.d"
import store from '../index'
interface Seller {
isSeller: boolean,
applyStatus: number,
}
const seller: Module<Seller, RootState> = {
namespaced: true,
state: {
isSeller: false,
applyStatus: null,
},
mutations: {
set_isSeller(state: Seller, value: boolean) {
state.isSeller = value
},
set_applyStatus(state: Seller, value: number) {
state.applyStatus = value
if (value == ApplyStatus.Approved) {
state.isSeller = true
}
},
},
actions: {
get_isSeller({ commit }) {
Https.axiosGet(Https.httpUrls.checkSellerDesigner).then(rv => {
commit('set_isSeller', !!rv)
})
},
}
}
export default seller

View File

@@ -475,6 +475,10 @@ export const Https = {
// 卖家端接口 // 卖家端接口
checkSellerDesigner: '/seller/designer/check', // 检查卖家是否为设计师 checkSellerDesigner: '/seller/designer/check', // 检查卖家是否为设计师
getSellerApplyStatus: '/seller/designer/apply/status', // 获取卖家申请状态
submitSellerApply: '/seller/designer/apply', // 提交卖家申请
getSellerOrderSummary: '/seller/order/summary', // 获取卖家订单数据总览
getSellerOrderList: '/seller/order/page', // 获取卖家订单列表
}, },

View File

@@ -373,11 +373,11 @@
<i class="fi fi-rs-notebook"></i> <i class="fi fi-rs-notebook"></i>
<span class="select_item_des">{{ $t('Header.ViewOrders') }}</span> <span class="select_item_des">{{ $t('Header.ViewOrders') }}</span>
</div> </div>
<div class="select_item" @click="onBecomeSeller"> <div class="select_item" @click="onBecomeSeller" v-if="!isSeller">
<span class="icon"><svg-icon name="seller-sellerIndex" /></span> <span class="icon"><svg-icon name="seller-sellerIndex" /></span>
<span class="select_item_des">{{ $t('Header.BecomeSeller') }}</span> <span class="select_item_des">{{ $t('Header.BecomeSeller') }}</span>
</div> </div>
<div class="select_item" @click="onSellerDashboard"> <div class="select_item" @click="onSellerDashboard" v-else>
<span class="icon"><svg-icon name="seller-sellerIndex" /></span> <span class="icon"><svg-icon name="seller-sellerIndex" /></span>
<span class="select_item_des">{{ $t('Header.SellerDashboard') }}</span> <span class="select_item_des">{{ $t('Header.SellerDashboard') }}</span>
<a-badge :dot="true"></a-badge> <a-badge :dot="true"></a-badge>
@@ -1073,9 +1073,13 @@ export default defineComponent({
} }
} }
const isSeller = computed(() => {
return store.state.seller.isSeller
})
return { return {
store, store,
userDetail, userDetail,
isSeller,
t, t,
...toRefs(homeMainData), ...toRefs(homeMainData),
...toRefs(historyData), ...toRefs(historyData),
@@ -1150,6 +1154,7 @@ export default defineComponent({
reject() reject()
}) })
}) })
this.store.dispatch('seller/get_isSeller')//获取是否是卖家
let isMurmur = getCookie('isMurmur') //获取是否是试用用户 let isMurmur = getCookie('isMurmur') //获取是否是试用用户
this.isMurmur = JSON.parse(isMurmur) this.isMurmur = JSON.parse(isMurmur)
if (this.userDetail.userId && this.userDetail.userId > -1) { if (this.userDetail.userId && this.userDetail.userId > -1) {
@@ -1215,7 +1220,6 @@ export default defineComponent({
let payOrder = this.$refs.payOrder let payOrder = this.$refs.payOrder
payOrder.init(orderId) payOrder.init(orderId)
} }
this.getCheckSellerDesigner()
}, },
methods: { methods: {
setTask(data) { setTask(data) {
@@ -1379,21 +1383,6 @@ export default defineComponent({
this.store.commit('set_dataLoading', false) this.store.commit('set_dataLoading', false)
}) })
}, },
//获取是否为卖家
getCheckSellerDesigner() {
const config = {
params: {
userId: this.userDetail.userId
}
}
Https.axiosGet(Https.httpUrls.checkSellerDesigner, config).then(rv => {
if (rv) {
console.log(rv)
return rv
}
return null
})
},
setLocale(v) { setLocale(v) {
// 同步更新 localStorage 中的 loginLanguage // 同步更新 localStorage 中的 loginLanguage
if (v) { if (v) {

View File

@@ -5,8 +5,8 @@
tip="Join the Stylish Parade and start selling your design work" tip="Join the Stylish Parade and start selling your design work"
/> />
<div class="content"> <div class="content">
<seller-review v-if="isSubmit" /> <seller-apply v-if="applyStatus === null" @submit="onSubmit" />
<seller-apply v-else @submit="isSubmit = true" /> <seller-review v-else />
</div> </div>
</div> </div>
</template> </template>
@@ -16,7 +16,20 @@
import sellerHeader from "../seller-header.vue" import sellerHeader from "../seller-header.vue"
import sellerReview from "./sellerReview.vue" import sellerReview from "./sellerReview.vue"
import sellerApply from "./sellerApply.vue" import sellerApply from "./sellerApply.vue"
const isSubmit = ref(false) import { Https } from "@/tool/https"
import { useStore } from "vuex"
import { ApplyStatus } from "@/store/seller/index.d"
const store = useStore()
const applyStatus = computed(() => store.state.seller.applyStatus)
const onSubmit = () => store.commit("seller/set_applyStatus", ApplyStatus.Pending)
const getSellerApplyStatus = () => {
store.commit("set_loading", true)
Https.axiosGet(Https.httpUrls.getSellerApplyStatus).then((res) => {
store.commit("set_loading", false)
store.commit("seller/set_applyStatus", res)
})
}
getSellerApplyStatus()
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
.become-seller { .become-seller {

View File

@@ -109,6 +109,7 @@
import { useRoute, useRouter } from "vue-router" import { useRoute, useRouter } from "vue-router"
const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()
import { Https } from "@/tool/https"
const emit = defineEmits(["submit"]) const emit = defineEmits(["submit"])
const formRules = { const formRules = {
storeName: [{ required: true, message: "Enter the store name" }], storeName: [{ required: true, message: "Enter the store name" }],
@@ -140,7 +141,20 @@
.validate() .validate()
.then(() => { .then(() => {
console.log(formData) console.log(formData)
emit("submit") const data = {
// userId: 0,
shopName: formData.storeName,
// avatar: "",
// brandBanner: "",
ownerName: formData.fullName,
email: formData.email,
mobile: formData.phoneNumber,
description: formData.description,
socialLinks: JSON.stringify(formData.links.filter((v) => v))
}
Https.axiosPost(Https.httpUrls.submitSellerApply, data).then((res) => {
emit("submit")
})
}) })
.catch(() => { .catch(() => {
console.log("validate failed") console.log("validate failed")

View File

@@ -23,23 +23,27 @@
<script setup> <script setup>
import { ref, computed } from "vue" import { ref, computed } from "vue"
import { useRoute, useRouter } from "vue-router" import { useRoute, useRouter } from "vue-router"
import { useStore } from "vuex"
import { ApplyStatus } from "@/store/seller/index.d"
const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()
const list = ref([ const store = useStore()
const applyStatus = computed(() => store.state.seller.applyStatus)
const list = computed(() => [
{ {
title: "Step 1: Submit Application", title: "Step 1: Submit Application",
tip: "Fill out the seller information form and agree to our terms", tip: "Fill out the seller information form and agree to our terms",
active: true active: [ApplyStatus.Pending, ApplyStatus.Approved].includes(applyStatus.value)
}, },
{ {
title: "Step 2: Review & Verification", title: "Step 2: Review & Verification",
tip: "Our team will review your application (typically 1-3 business days)", tip: "Our team will review your application (typically 1-3 business days)",
active: false active: applyStatus.value === ApplyStatus.Approved
}, },
{ {
title: "Step 3: Start Selling", title: "Step 3: Start Selling",
tip: "Once approved, access your seller dashboard and start listing products ", tip: "Once approved, access your seller dashboard and start listing products ",
active: false active: applyStatus.value === ApplyStatus.Approved
} }
]) ])
const onBackToHome = () => { const onBackToHome = () => {

View File

@@ -42,8 +42,8 @@
<div class="item"> <div class="item">
<div class="images"> <div class="images">
<img <img
v-for="(v, i) in v.item.slice(0, maxItemNum)" v-for="v in v.item.slice(0, maxItemNum)"
:key="i" :key="v.id"
:src="v.url" :src="v.url"
/> />
<span v-if="v.item.length > maxItemNum" <span v-if="v.item.length > maxItemNum"
@@ -51,7 +51,7 @@
> >
</div> </div>
<div class="titles"> <div class="titles">
<div v-for="(v, i) in v.item.slice(0, maxItemNum)" :key="i"> <div v-for="v in v.item.slice(0, maxItemNum)" :key="v.id">
{{ v.title }} {{ v.title }}
</div> </div>
<span v-if="v.item.length > maxItemNum">...</span> <span v-if="v.item.length > maxItemNum">...</span>
@@ -65,6 +65,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="null" v-show="list.length === 0 && !loading && finish">no data</div>
<div class="placeholder" ref="placeholderRef" v-show="!loading"></div> <div class="placeholder" ref="placeholderRef" v-show="!loading"></div>
<div class="footer" :class="{ null: list.length === 0 }" v-if="!finish"> <div class="footer" :class="{ null: list.length === 0 }" v-if="!finish">
<a-spin :delay="0.5" v-show="loading" /> <a-spin :delay="0.5" v-show="loading" />
@@ -74,22 +75,28 @@
</template> </template>
<script setup> <script setup>
import { ref, onMounted, onBeforeUnmount } from "vue" import { ref, onMounted, onBeforeUnmount, computed } from "vue"
const totals = ref([ import { Https } from "@/tool/https"
const totals_obj = ref({
totalRevenue: "--",
totalPurchases: "--",
totalViews: "--"
})
const totals = computed(() => [
{ {
icon: "seller-qiandaizi", icon: "seller-qiandaizi",
title: "Total Revenue", title: "Total Revenue",
value: "HK$ 54,32.00" value: `HK$ ${totals_obj.value.totalRevenue}`
}, },
{ {
icon: "seller-gouwudai", icon: "seller-gouwudai",
title: "Total Purchases", title: "Total Purchases",
value: "128" value: totals_obj.value.totalPurchases
}, },
{ {
icon: "seller-eye", icon: "seller-eye",
title: "Total Views", title: "Total Views",
value: "4,982" value: totals_obj.value.totalViews
} }
]) ])
const maxItemNum = ref(2) const maxItemNum = ref(2)
@@ -112,38 +119,41 @@
page: page.value, page: page.value,
size: size.value size: size.value
} }
if (nameOrId.value) data.nameOrId = nameOrId.value if (nameOrId.value) data.keyword = nameOrId.value
console.log(data) Https.axiosGet(Https.httpUrls.getSellerOrderList, { params: data }).then((res) => {
setTimeout(() => { res.content?.forEach((v) => {
for (let i = 0; i < size.value; i++) { const obj = {
let { date, time, dateTime } = formatTimestamp(new Date(2026, 4, 20, 13, 14).getTime()) orderId: v.orderId,
list.value.push({ items: v.items.map((item) => ({
orderId: "SP" + Math.random().toString().substring(2, 10), id: item.productId,
price: "HK$ " + (Math.random() * 500).toFixed(2), url: item.thumbnailUrl,
username: "@liuyuchen", title: item.productName
date: date, })),
time: time, price: "HK$ " + v.price,
item: [ username: v.buyerUsername,
{ date: v.date,
url: "http://118.31.39.42:3000/falls/o-1.png", time: v.date
title: "North Outfit Set" }
}, list.value.push(obj)
{ })
url: "http://118.31.39.42:3000/falls/o-2.png",
title: "Heritage Layered Set" total.value = res.total
},
{},
{}
]
})
}
total.value = 30
page.value++ page.value++
finish.value = page.value > total.value / 10 finish.value = page.value > total.value / size.value
loading.value = false loading.value = false
}, 1000) })
} }
const getSummary = () => {
Https.axiosGet(Https.httpUrls.getSellerOrderSummary).then((res) => {
totals_obj.value.totalRevenue = res.totalRevenue
totals_obj.value.totalPurchases = res.totalPurchases
totals_obj.value.totalViews = res.totalViews
})
}
getSummary()
getList(true) getList(true)
const placeholderRef = ref(null) const placeholderRef = ref(null)
const observer = new IntersectionObserver( const observer = new IntersectionObserver(
(entries) => { (entries) => {
@@ -348,6 +358,11 @@
} }
} }
} }
> .null {
margin-top: 10rem;
text-align: center;
color: #999;
}
> .footer { > .footer {
min-height: 10rem; min-height: 10rem;
display: flex; display: flex;