|
|
|
@ -43,39 +43,40 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script setup name="enterpriseHome"> |
|
|
|
import Vconsolefrom from 'vconsole'; |
|
|
|
import * as w6s from 'szient-js-sdk'; |
|
|
|
import sha1 from 'crypto-js/sha1'; |
|
|
|
import { Loading } from 'vant'; |
|
|
|
import {getEnterpriseMerchantAuthorization, getSiqLoginAuth, siqCode} from '../../api/Home'; |
|
|
|
import {showSuccessToast} from "vant"; |
|
|
|
import 'vant/es/toast/style'; |
|
|
|
const {useCommon} = $globalStore; |
|
|
|
const router = useRouter(); |
|
|
|
const route = useRoute(); |
|
|
|
let carouselList = reactive([]); // 轮播列表 |
|
|
|
const isLoading = ref(true); |
|
|
|
let freshMap = reactive({ |
|
|
|
import Vconsolefrom from 'vconsole'; |
|
|
|
import * as w6s from 'szient-js-sdk'; |
|
|
|
import sha1 from 'crypto-js/sha1'; |
|
|
|
import {Loading} from 'vant'; |
|
|
|
import {getEnterpriseMerchantAuthorization, getSiqLoginAuth, siqCode} from '../../api/enterprise'; |
|
|
|
import {showSuccessToast} from "vant"; |
|
|
|
import 'vant/es/toast/style'; |
|
|
|
|
|
|
|
const {useCommon} = $globalStore; |
|
|
|
const router = useRouter(); |
|
|
|
const route = useRoute(); |
|
|
|
let carouselList = reactive([]); // 轮播列表 |
|
|
|
const isLoading = ref(true); |
|
|
|
let freshMap = reactive({ |
|
|
|
refreshLoad: false, // 是否刷新 |
|
|
|
listLoading: false, // 是否加载中 |
|
|
|
listFinished: false, // 是否加载完成标识 |
|
|
|
}); |
|
|
|
const data = reactive({}); |
|
|
|
const boutiqueAttr = reactive({ |
|
|
|
}); |
|
|
|
const data = reactive({}); |
|
|
|
const boutiqueAttr = reactive({ |
|
|
|
columnNum: 4, |
|
|
|
itemClass: "boutique_item", |
|
|
|
goodsCradclass: "boutique-crad", |
|
|
|
}); // 商品卡片展示 |
|
|
|
}); // 商品卡片展示 |
|
|
|
|
|
|
|
//获取轮播 |
|
|
|
const getCarousel = async () => { |
|
|
|
}; |
|
|
|
//获取轮播 |
|
|
|
const getCarousel = async () => { |
|
|
|
}; |
|
|
|
|
|
|
|
//精品 |
|
|
|
const boutiqueGoods = async () => { |
|
|
|
}; |
|
|
|
//精品 |
|
|
|
const boutiqueGoods = async () => { |
|
|
|
}; |
|
|
|
|
|
|
|
const toRegisterView = async () => { |
|
|
|
const toRegisterView = async () => { |
|
|
|
if (useCommon.enterpriseNumber == null || useCommon.enterpriseNumber == "") { |
|
|
|
router.push({path: "/enterprise/register"}); |
|
|
|
} else { |
|
|
|
@ -86,14 +87,14 @@ |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
const toRegistrationListView = async () => { |
|
|
|
const toRegistrationListView = async () => { |
|
|
|
router.push({ |
|
|
|
path: "/enterprise/registrationList", |
|
|
|
}); |
|
|
|
} |
|
|
|
const toComplaintView = async () => { |
|
|
|
} |
|
|
|
const toComplaintView = async () => { |
|
|
|
router.push({ |
|
|
|
path: "/enterprise/complaint", |
|
|
|
query: { |
|
|
|
@ -101,39 +102,59 @@ |
|
|
|
isSelect: true |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//下拉刷新 |
|
|
|
const onRefresh = () => { |
|
|
|
//下拉刷新 |
|
|
|
const onRefresh = () => { |
|
|
|
freshMap.listFinished = false; |
|
|
|
freshMap.listLoading = true; |
|
|
|
freshMap.refreshLoad = true; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
// 触底加载 |
|
|
|
const onLoad = () => { |
|
|
|
}; |
|
|
|
// 触底加载 |
|
|
|
const onLoad = () => { |
|
|
|
}; |
|
|
|
|
|
|
|
const generateRandomNumber = () => { |
|
|
|
const generateRandomNumber = () => { |
|
|
|
const min = 100000; |
|
|
|
const max = 999999; |
|
|
|
const randomNum = (Math.floor(Math.random() * (max - min + 1)) + min); |
|
|
|
return randomNum.toString().padStart(6, '0'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const getEnterpriseMerchant = (enterpriseNum, phoneNumber) => { |
|
|
|
const getEnterpriseMerchant = (enterpriseNum, phoneNumber) => { |
|
|
|
getEnterpriseMerchantAuthorization({enterpriseNumber: enterpriseNum, merchantTel: phoneNumber}, success => { |
|
|
|
console.log('------------->>>: ', success.data[0].enterpriseNumber) |
|
|
|
if (!(success.data == null && success.data.length == 0)) { |
|
|
|
//debugger; |
|
|
|
//console.log('------------->>>: ', success.data[0].enterpriseNumber) |
|
|
|
if (success.data != null && success.data.length > 0) { |
|
|
|
useCommon.SET_USER_ENTERPRISE_NUMBER(success.data[0].enterpriseNumber); |
|
|
|
} |
|
|
|
}, error => { |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
// 判断用户信息是否已完整(企业端登录后已写入store) |
|
|
|
const hasUserInfo = () => { |
|
|
|
return useCommon.userId |
|
|
|
&& useCommon.enterpriseName |
|
|
|
&& useCommon.enterpriseNumber |
|
|
|
&& useCommon.enterpriseId; |
|
|
|
}; |
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
console.log(useCommon.firstLoad); |
|
|
|
console.log(useCommon); |
|
|
|
isLoading.value = useCommon.firstLoad; |
|
|
|
|
|
|
|
// 如果store中已存在完整的用户和企业信息,则跳过w6s鉴权 |
|
|
|
if (hasUserInfo()) { |
|
|
|
console.log("用户信息已存在,跳过w6s鉴权"); |
|
|
|
isLoading.value = false; |
|
|
|
getEnterpriseMerchant(useCommon.enterpriseNumber.toString(), useCommon.phonenumber.toString()); |
|
|
|
useCommon.SET_IS_FIRST_LOAD(false); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
siqCode(null, success => { |
|
|
|
let access_key = ""; |
|
|
|
let access_secret = ""; |
|
|
|
@ -161,7 +182,7 @@ |
|
|
|
console.log("鉴权", res); |
|
|
|
}).catch((err) => { |
|
|
|
console.log("鉴权", err); |
|
|
|
getEnterpriseMerchant(useCommon.enterpriseNumber.toString(), useCommon.phonenumber.toString()); |
|
|
|
//getEnterpriseMerchant(useCommon.enterpriseNumber.toString(), useCommon.phonenumber.toString()); |
|
|
|
}); |
|
|
|
|
|
|
|
w6s.ready(() => { |
|
|
|
@ -179,13 +200,13 @@ |
|
|
|
useCommon.SET_TOKEN(success.data.token); |
|
|
|
console.log(useCommon.userId); |
|
|
|
console.log(useCommon.firstLoad); |
|
|
|
if(useCommon.firstLoad){ |
|
|
|
if (useCommon.firstLoad) { |
|
|
|
isLoading.value = false; |
|
|
|
} |
|
|
|
//设置已经初始化 |
|
|
|
useCommon.SET_IS_FIRST_LOAD(false) |
|
|
|
getEnterpriseMerchant(success.data.enterpriseNumber.toString(), success.data.phonenumber.toString()); |
|
|
|
if(useCommon.firstLoad){ |
|
|
|
if (useCommon.firstLoad) { |
|
|
|
isLoading.value = false; |
|
|
|
} |
|
|
|
}, error => { |
|
|
|
@ -200,16 +221,16 @@ |
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
const { VITE_BASE_URL,access_key,access_secret } = import.meta.env; |
|
|
|
const {VITE_BASE_URL, access_key, access_secret} = import.meta.env; |
|
|
|
console.log(VITE_BASE_URL); |
|
|
|
const apiUrl = ref(import.meta.env.accessKey); |
|
|
|
console.log(access_key); |
|
|
|
console.log(access_secret); |
|
|
|
}); |
|
|
|
}); |
|
|
|
</script> |
|
|
|
|
|
|
|
<style lang="less" scoped> |
|
|
|
.home { |
|
|
|
.home { |
|
|
|
display: flex; |
|
|
|
flex-direction: column; |
|
|
|
height: 100%; |
|
|
|
@ -387,9 +408,9 @@ |
|
|
|
width: 100%; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.logobox { |
|
|
|
.logobox { |
|
|
|
position: relative; |
|
|
|
top: 4%; |
|
|
|
left: 5%; |
|
|
|
@ -398,25 +419,26 @@ |
|
|
|
height: 10vh; |
|
|
|
background: url("../../assets/images/logo.png") no-repeat; |
|
|
|
background-size: 100% auto; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@media screen and (max-width: 380px) { |
|
|
|
@media screen and (max-width: 380px) { |
|
|
|
.home .warp_body { |
|
|
|
background: #c6e6ff url("../../assets/images/bg_c.jpg") no-repeat top; |
|
|
|
background-size: 100% auto; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@media screen and (min-width: 540px) { |
|
|
|
@media screen and (min-width: 540px) { |
|
|
|
.home .warp_body { |
|
|
|
background: #c6e6ff url("../../assets/images/bg_c.jpg") no-repeat top; |
|
|
|
background-size: 100% auto; |
|
|
|
} |
|
|
|
} |
|
|
|
.loading-div{ |
|
|
|
} |
|
|
|
|
|
|
|
.loading-div { |
|
|
|
position: absolute; |
|
|
|
top: 45%; |
|
|
|
left: 48%; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
</style> |
|
|
|
|