卖家端申请接口。人口
This commit is contained in:
@@ -7,6 +7,7 @@ import UserHabit from './userHabit/userHabit'
|
||||
import Workspace from './workspace/workspace'
|
||||
import Guide from './guide/guide'
|
||||
import adminPage from './adminPage/adminPage'
|
||||
import seller from './seller/index'
|
||||
export interface RootState{
|
||||
|
||||
}
|
||||
@@ -41,5 +42,6 @@ export default createStore<RootState>({
|
||||
Workspace,
|
||||
Guide,
|
||||
adminPage,
|
||||
seller,
|
||||
}
|
||||
})
|
||||
|
||||
6
src/store/seller/index.d.ts
vendored
Normal file
6
src/store/seller/index.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export const ApplyStatus = {
|
||||
Null: null,// 未申请过
|
||||
Pending: 0,// 已提交, 待审核
|
||||
Approved: 1,// 审核通过
|
||||
Rejected: 2,// 审核拒绝
|
||||
}
|
||||
40
src/store/seller/index.ts
Normal file
40
src/store/seller/index.ts
Normal 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
|
||||
@@ -475,6 +475,10 @@ export const Https = {
|
||||
|
||||
// 卖家端接口
|
||||
checkSellerDesigner: '/seller/designer/check', // 检查卖家是否为设计师
|
||||
getSellerApplyStatus: '/seller/designer/apply/status', // 获取卖家申请状态
|
||||
submitSellerApply: '/seller/designer/apply', // 提交卖家申请
|
||||
getSellerOrderSummary: '/seller/order/summary', // 获取卖家订单数据总览
|
||||
getSellerOrderList: '/seller/order/page', // 获取卖家订单列表
|
||||
|
||||
},
|
||||
|
||||
|
||||
@@ -373,11 +373,11 @@
|
||||
<i class="fi fi-rs-notebook"></i>
|
||||
<span class="select_item_des">{{ $t('Header.ViewOrders') }}</span>
|
||||
</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="select_item_des">{{ $t('Header.BecomeSeller') }}</span>
|
||||
</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="select_item_des">{{ $t('Header.SellerDashboard') }}</span>
|
||||
<a-badge :dot="true"></a-badge>
|
||||
@@ -1073,9 +1073,13 @@ export default defineComponent({
|
||||
}
|
||||
}
|
||||
|
||||
const isSeller = computed(() => {
|
||||
return store.state.seller.isSeller
|
||||
})
|
||||
return {
|
||||
store,
|
||||
userDetail,
|
||||
isSeller,
|
||||
t,
|
||||
...toRefs(homeMainData),
|
||||
...toRefs(historyData),
|
||||
@@ -1150,6 +1154,7 @@ export default defineComponent({
|
||||
reject()
|
||||
})
|
||||
})
|
||||
this.store.dispatch('seller/get_isSeller')//获取是否是卖家
|
||||
let isMurmur = getCookie('isMurmur') //获取是否是试用用户
|
||||
this.isMurmur = JSON.parse(isMurmur)
|
||||
if (this.userDetail.userId && this.userDetail.userId > -1) {
|
||||
@@ -1215,7 +1220,6 @@ export default defineComponent({
|
||||
let payOrder = this.$refs.payOrder
|
||||
payOrder.init(orderId)
|
||||
}
|
||||
this.getCheckSellerDesigner()
|
||||
},
|
||||
methods: {
|
||||
setTask(data) {
|
||||
@@ -1379,21 +1383,6 @@ export default defineComponent({
|
||||
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) {
|
||||
// 同步更新 localStorage 中的 loginLanguage
|
||||
if (v) {
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
tip="Join the Stylish Parade and start selling your design work"
|
||||
/>
|
||||
<div class="content">
|
||||
<seller-review v-if="isSubmit" />
|
||||
<seller-apply v-else @submit="isSubmit = true" />
|
||||
<seller-apply v-if="applyStatus === null" @submit="onSubmit" />
|
||||
<seller-review v-else />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -16,7 +16,20 @@
|
||||
import sellerHeader from "../seller-header.vue"
|
||||
import sellerReview from "./sellerReview.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>
|
||||
<style scoped lang="less">
|
||||
.become-seller {
|
||||
|
||||
@@ -109,6 +109,7 @@
|
||||
import { useRoute, useRouter } from "vue-router"
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
import { Https } from "@/tool/https"
|
||||
const emit = defineEmits(["submit"])
|
||||
const formRules = {
|
||||
storeName: [{ required: true, message: "Enter the store name" }],
|
||||
@@ -140,7 +141,20 @@
|
||||
.validate()
|
||||
.then(() => {
|
||||
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(() => {
|
||||
console.log("validate failed")
|
||||
|
||||
@@ -23,23 +23,27 @@
|
||||
<script setup>
|
||||
import { ref, computed } from "vue"
|
||||
import { useRoute, useRouter } from "vue-router"
|
||||
import { useStore } from "vuex"
|
||||
import { ApplyStatus } from "@/store/seller/index.d"
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const list = ref([
|
||||
const store = useStore()
|
||||
const applyStatus = computed(() => store.state.seller.applyStatus)
|
||||
const list = computed(() => [
|
||||
{
|
||||
title: "Step 1: Submit Application",
|
||||
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",
|
||||
tip: "Our team will review your application (typically 1-3 business days)",
|
||||
active: false
|
||||
active: applyStatus.value === ApplyStatus.Approved
|
||||
},
|
||||
{
|
||||
title: "Step 3: Start Selling",
|
||||
tip: "Once approved, access your seller dashboard and start listing products ",
|
||||
active: false
|
||||
active: applyStatus.value === ApplyStatus.Approved
|
||||
}
|
||||
])
|
||||
const onBackToHome = () => {
|
||||
|
||||
@@ -42,8 +42,8 @@
|
||||
<div class="item">
|
||||
<div class="images">
|
||||
<img
|
||||
v-for="(v, i) in v.item.slice(0, maxItemNum)"
|
||||
:key="i"
|
||||
v-for="v in v.item.slice(0, maxItemNum)"
|
||||
:key="v.id"
|
||||
:src="v.url"
|
||||
/>
|
||||
<span v-if="v.item.length > maxItemNum"
|
||||
@@ -51,7 +51,7 @@
|
||||
>
|
||||
</div>
|
||||
<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 }}
|
||||
</div>
|
||||
<span v-if="v.item.length > maxItemNum">...</span>
|
||||
@@ -65,6 +65,7 @@
|
||||
</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="footer" :class="{ null: list.length === 0 }" v-if="!finish">
|
||||
<a-spin :delay="0.5" v-show="loading" />
|
||||
@@ -74,22 +75,28 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted, onBeforeUnmount } from "vue"
|
||||
const totals = ref([
|
||||
import { ref, onMounted, onBeforeUnmount, computed } from "vue"
|
||||
import { Https } from "@/tool/https"
|
||||
const totals_obj = ref({
|
||||
totalRevenue: "--",
|
||||
totalPurchases: "--",
|
||||
totalViews: "--"
|
||||
})
|
||||
const totals = computed(() => [
|
||||
{
|
||||
icon: "seller-qiandaizi",
|
||||
title: "Total Revenue",
|
||||
value: "HK$ 54,32.00"
|
||||
value: `HK$ ${totals_obj.value.totalRevenue}`
|
||||
},
|
||||
{
|
||||
icon: "seller-gouwudai",
|
||||
title: "Total Purchases",
|
||||
value: "128"
|
||||
value: totals_obj.value.totalPurchases
|
||||
},
|
||||
{
|
||||
icon: "seller-eye",
|
||||
title: "Total Views",
|
||||
value: "4,982"
|
||||
value: totals_obj.value.totalViews
|
||||
}
|
||||
])
|
||||
const maxItemNum = ref(2)
|
||||
@@ -112,38 +119,41 @@
|
||||
page: page.value,
|
||||
size: size.value
|
||||
}
|
||||
if (nameOrId.value) data.nameOrId = nameOrId.value
|
||||
console.log(data)
|
||||
setTimeout(() => {
|
||||
for (let i = 0; i < size.value; i++) {
|
||||
let { date, time, dateTime } = formatTimestamp(new Date(2026, 4, 20, 13, 14).getTime())
|
||||
list.value.push({
|
||||
orderId: "SP" + Math.random().toString().substring(2, 10),
|
||||
price: "HK$ " + (Math.random() * 500).toFixed(2),
|
||||
username: "@liuyuchen",
|
||||
date: date,
|
||||
time: time,
|
||||
item: [
|
||||
{
|
||||
url: "http://118.31.39.42:3000/falls/o-1.png",
|
||||
title: "North Outfit Set"
|
||||
},
|
||||
{
|
||||
url: "http://118.31.39.42:3000/falls/o-2.png",
|
||||
title: "Heritage Layered Set"
|
||||
},
|
||||
{},
|
||||
{}
|
||||
]
|
||||
})
|
||||
}
|
||||
total.value = 30
|
||||
if (nameOrId.value) data.keyword = nameOrId.value
|
||||
Https.axiosGet(Https.httpUrls.getSellerOrderList, { params: data }).then((res) => {
|
||||
res.content?.forEach((v) => {
|
||||
const obj = {
|
||||
orderId: v.orderId,
|
||||
items: v.items.map((item) => ({
|
||||
id: item.productId,
|
||||
url: item.thumbnailUrl,
|
||||
title: item.productName
|
||||
})),
|
||||
price: "HK$ " + v.price,
|
||||
username: v.buyerUsername,
|
||||
date: v.date,
|
||||
time: v.date
|
||||
}
|
||||
list.value.push(obj)
|
||||
})
|
||||
|
||||
total.value = res.total
|
||||
page.value++
|
||||
finish.value = page.value > total.value / 10
|
||||
finish.value = page.value > total.value / size.value
|
||||
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)
|
||||
|
||||
const placeholderRef = ref(null)
|
||||
const observer = new IntersectionObserver(
|
||||
(entries) => {
|
||||
@@ -348,6 +358,11 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
> .null {
|
||||
margin-top: 10rem;
|
||||
text-align: center;
|
||||
color: #999;
|
||||
}
|
||||
> .footer {
|
||||
min-height: 10rem;
|
||||
display: flex;
|
||||
|
||||
Reference in New Issue
Block a user