加入申請為經銷商

main
Wayne Hsu 3 years ago
parent 743107cbdf
commit 652c5fb41c

12
components.d.ts vendored

@ -14,15 +14,27 @@ declare module '@vue/runtime-core' {
UserHeader: typeof import('./src/components/UserHeader.vue')['default']
VanButton: typeof import('vant/es')['Button']
VanCellGroup: typeof import('vant/es')['CellGroup']
VanCollapse: typeof import('vant/es')['Collapse']
VanCollapseItem: typeof import('vant/es')['CollapseItem']
VanDatePicker: typeof import('vant/es')['DatePicker']
VanDialog: typeof import('vant/es')['Dialog']
VanField: typeof import('vant/es')['Field']
VanForm: typeof import('vant/es')['Form']
VanGrid: typeof import('vant/es')['Grid']
VanGridItem: typeof import('vant/es')['GridItem']
VanIcon: typeof import('vant/es')['Icon']
VanList: typeof import('vant/es')['List']
VanNavBar: typeof import('vant/es')['NavBar']
VanOverlay: typeof import('vant/es')['Overlay']
VanPicker: typeof import('vant/es')['Picker']
VanPopover: typeof import('vant/es')['Popover']
VanPopup: typeof import('vant/es')['Popup']
VanPullRefresh: typeof import('vant/es')['PullRefresh']
VanRadio: typeof import('vant/es')['Radio']
VanRadioGroup: typeof import('vant/es')['RadioGroup']
VanSwipe: typeof import('vant/es')['Swipe']
VanSwipeItem: typeof import('vant/es')['SwipeItem']
VanSwitch: typeof import('vant/es')['Switch']
VanTab: typeof import('vant/es')['Tab']
VanTabs: typeof import('vant/es')['Tabs']
VanUploader: typeof import('vant/es')['Uploader']

@ -70,10 +70,8 @@
<i class="icon-link-variant icli"></i>
<span>推薦連結</span>
</a>
<button v-clipboard:copy="userInfo.refer_url"
v-clipboard:success="onSuccess"
v-clipboard:error="onError"
>複制</button>
<button v-clipboard:copy="userInfo.refer_url" v-clipboard:success="onSuccess"
v-clipboard:error="onError">複制</button>
</li>
<li @click="$router.push('/address')">
<a class="nav-link title-color font-sm">
@ -93,6 +91,7 @@
<i class="icon-chevron-right"></i>
</a>
</li>
<template v-if="userInfo.is_resale === 1">
<li @click="$router.push('/user/account')">
<a class="nav-link title-color font-sm">
<i class="icon-home icli"></i>
@ -120,9 +119,22 @@
<i class="icon-chevron-right"></i>
</a>
</li>
</template>
<template v-else>
<li @click="handleBeResale">
<a class="nav-link title-color font-sm">
<i class="icon-bank icli"></i>
<span>成為經銷商</span>
</a>
<a class="arrow">
<i class="icon-chevron-right"></i>
</a>
</li>
</template>
</ul>
<!-- Navigation End -->
<button class="log-out" data-bs-toggle="offcanvas" data-bs-target="#confirmation" aria-controls="confirmation" @click="handleLogout">
<button class="log-out" data-bs-toggle="offcanvas" data-bs-target="#confirmation" aria-controls="confirmation"
@click="handleLogout">
<i class="icon-arrow-right-bold-box icli"></i>
登出
</button>
@ -142,9 +154,12 @@ import { useShopStore } from '@/store/Shop'
import { getUserInfo } from '@/services/user'
import { showToast } from 'vant';
import { showConfirmDialog } from 'vant';
import defaultAvatar from '@/assets/images/avatar/avatar.png'
import {updateUserResale} from '@/services/user'
import { getArticle } from '@/services/article'
// (async ()=>{
// await liff.init({ liffId: '1657782615-qGK9WQ5m' });
// })()
@ -154,6 +169,7 @@ const router = useRouter()
const shopStore = useShopStore()
const userInfo = ref({})
const resaleRule = ref('')
onMounted(async () => {
@ -163,8 +179,33 @@ onMounted(async () => {
if (res.code === 200) {
userInfo.value = res.data
}
let resArticle = await getArticle(146)
if(resArticle.code === 200){
resaleRule.value = resArticle.data.content
}
})
const handleBeResale = async () => {
try{
await showConfirmDialog({
title: '申請成為經銷商',
message: resaleRule.value,
})
let res = await updateUserResale()
if(res.code === 200){
userInfo.value.is_resale = 1
return showToast('您已成為本站經銷商')
}else{
showToast(res.msg)
}
}catch(e){
return
}
}
const handleLogout = () => {
Cookies.remove('token', { domain: shopStore.sso_domain })
Cookies.remove('uid', { domain: shopStore.sso_domain })
@ -188,21 +229,25 @@ const onError = () => {
.media-body {
width: 100%;
}
.media-right {
// width: 100%;
vertical-align: text-top;
text-align: right;
i {
font-size: 20px;
}
}
}
.user-info-block {
box-sizing: content-box;
display: flex;
flex-wrap: wrap;
justify-content: space-around;
.user-info {
// flex: 1;
border: 1px gray solid;
@ -212,5 +257,4 @@ const onError = () => {
width: 48%;
}
}
</style>

@ -59,3 +59,7 @@ export function updateUserBank(params) {
export function getRecommandList(page) {
return request('/user/getRecommandList', 'get', {page})
}
export function updateUserResale() {
return request('/user/updateUserResale', 'get')
}
Loading…
Cancel
Save