123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>商城-创业帮</title>
- <meta name="keywords" content="商城-创业帮">
- <meta name="description" content="商城-创业帮">
- <meta content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,shrink-to-fit=no,user-scalable=no" name="viewport" viewport="cover">
- <meta name="apple-mobile-web-app-capable" content="yes">
- <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
- <meta content="telephone=no" name="format-detection">
- <meta content="email=no" name="format-detection">
- <meta name="apple-mobile-web-app-title" content="商城-创业帮">
- <meta http-equiv="Cache-Control" content="no-siteapp">
- <link rel="stylesheet" href="./static/css/main.css">
- <style>
- .van-card__thumb .van-image{
- height:100%;
- width:100%;
- }
- </style>
- </head>
- <body class="pt0 pb0" style="padding-top:0;">
- <div id="app">
- <van-nav-bar class="bottom_line mall_title" title="创业帮商城" v-if="toptitleisshow" right-text="我的订单" @click-right="rightbtn"></van-nav-bar>
- <div class="mall ovh-x" v-cloak ref="wrapper2">
- <van-pull-refresh v-model="refreshing" @refresh="onRefresh" :class="products.length === 0 ? 'isnodata':''" style="height:100%;">
- <van-list v-model="loading" :finished="finished" finished-text="没有更多数据了" @load="onLoad" :immediate-check="false">
- <van-empty class="custom-image" image="./static/images/empty-img.png" description="暂无数据" v-if="isnodata"></van-empty>
- <van-card class="van-hairline--bottom" :price="item.Price | tofixed2" :desc="item.Details" :title="item.ProductName" v-for="item,index in products" :key="index" :lazy-load="true" @click="gomalldetail(item.Id)">
- <template v-slot:thumb>
- <van-image :src="item.ListPicPath">
- <template v-slot:loading>
- <van-loading type="spinner" size="20"></van-loading>
- </template>
- </van-image>
- </template>
- </van-card>
- </van-list>
- </van-pull-refresh>
- </div>
- <van-tabbar v-model="active" active-color="#333" inactive-color="#999" v-cloak v-if="tabsisshow">
- <van-tabbar-item icon="home-o" @click="index">首页
- <template #icon="props"><img :src="props.active ? icon1.active : icon1.inactive"></template>
- </van-tabbar-item>
- <van-tabbar-item icon="search">商城
- <template #icon="props"><img :src="props.active ? icon2.active : icon2.inactive"></template>
- </van-tabbar-item>
- <van-tabbar-item icon="friends-o" @click="notice" :dot="isnotice">消息
- <template #icon="props"><img :src="props.active ? icon3.active : icon3.inactive"></template>
- </van-tabbar-item>
- <van-tabbar-item icon="setting-o" @click="user">我的
- <template #icon="props"><img :src="props.active ? icon4.active : icon4.inactive"></template>
- </van-tabbar-item>
- </van-tabbar>
- </div>
- <script src="./static/js/klm-vv.min.js"></script>
- <script src="./static/js/appfunc.min.js"></script>
- <script src="./static/js/klm-axios-config.js"></script>
- <script src="./static/js/publicfn.js"> </script>
- <script>
- function OnStart(){
- app.verificationrealauth();
- };
- // 通过 CDN 引入时不会自动注册 Lazyload 组件
- // 可以通过下面的方式手动注册
- Vue.use(vant.Lazyload);
-
- // 在 #app 标签下渲染一个按钮组件
- let app = new Vue({
- el: '#app',
- data() {
- return {
- test:'',
- isnodata:false,
- toptitleisshow:false,
- realauth:false,
- active: 1,
- products:[],
- pageinfo:{
- PageSize:20,
- PageNum:1
- },
- loading: false,
- finished: false,
- refreshing: false,
- icon1: {
- active: './static/images/tab-icon1-active1@3x.png',
- inactive: './static/images/tab-icon1-no@3x.png',
- },
- icon2: {
- active: './static/images/tab-icon2-active1@3x.png',
- inactive: './static/images/tab-icon2-no@3x.png',
- },
- icon3: {
- active: './static/images/tab-icon3-active1@3x.png',
- inactive: './static/images/tab-icon3-no@3x.png',
- },
- icon4: {
- active: './static/images/tab-icon4-active1@3x.png',
- inactive: './static/images/tab-icon4-no@3x.png',
- },
- tabsisshow:'',
- leader:0,
- };
- },
- created() {
- this.toptitleisshow = toptitleisshow;
- this.tabsisshow = bottomtabisshow;
- this.getmalllist();
- this.verificationrealauth();
- if(JSON.parse(PublicLib.getCookieInfo('userInfo')).LeaderLevel){
- this.leader = JSON.parse(PublicLib.getCookieInfo('userInfo')).LeaderLevel;
- };
- },
- computed:{
- isnotice:function(){
- return PublicLib.getCookieInfo('noticeiscount') !== "";
- }
- },
- beforeUpdate(){
- this.$nextTick(() => {
- this.$refs.wrapper2.style.height = `${document.documentElement.clientHeight}px`;
- });
- },
- methods: {
- //- 获取商城列表
- async getmalllist(){
- //- PublicLib.ShowLoading({Message:''});
- const res = await getRequest('api/v1/products/list?t='+Math.random(6),JSON.stringify(this.pageinfo));
- if(res.status !== '1') return tips('获取商品列表失败,请重试!')
- //- PublicLib.HideLoading();
- if (res.data.length < this.pageinfo.PageSize) {
- this.finished = true;
- };
- this.products.push(...res.data);
- this.loading = false;
- if(this.products.length === 0) {this.isnodata = true}else{this.isnodata = false};
- },
- //- 第一次获取商城列表
- async getfirstmalllist(){
- //- PublicLib.ShowLoading({Message:''});
- const res = await getRequest('api/v1/products/list?t='+Math.random(6),JSON.stringify(this.pageinfo));
- if(res.status !== '1') return tips('获取商品列表失败,请重试!')
- //- PublicLib.HideLoading();
- if (res.data.length < this.pageinfo.PageSize) {
- this.finished = true;
- };
- this.products = res.data;
- this.loading = false;
- this.refreshing = false;
- if(this.products.length === 0) {this.isnodata = true}else{this.isnodata = false};
- },
- onLoad() {
- if (this.refreshing) {
- this.products = [];
- this.refreshing = false;
- this.pageinfo.PageNum = 0;
- }
- this.pageinfo.PageNum++;
- this.getmalllist();
- },
- onRefresh() {
- // 清空列表数据
- this.finished = false;
- // 重新加载数据
- // 将 loading 设置为 true,表示处于加载状态
- this.loading = true;
- this.getfirstmalllist();
- },
- async verificationrealauth(){
- const Id = PublicLib.getCookieInfo('userId');
- const userinfo = await getRequest('api/v1/users/personalinfo',JSON.stringify({Id}));
- //- 是否实名认证完毕
- if(userinfo.data.AuthFlag !== 1) {
- this.realauth = true;
- }else{
- this.realauth = false;
- };
- },
- //- 跳转商品详情
- gomalldetail(id){
- if(this.realauth){
- PublicLib.ShowDialog({
- Title:'暂未实名认证',
- Message:'是否去实名认证?',
- ConfirmText:'去实名',
- CancelText:'暂不实名',
- ConfirmAction:'app.goAuth()',
- CanelAction:''
- });
- return;
- };
- console.log(this.leader,id);
- if(this.leader === 2 && id === 28){
- return tips('已经成为大盟主,请勿下单小盟主');
- };
- PublicLib.putCookieInfo('malldetailId', id);
- PublicLib.Goto({Url:'mall-detail'});
- },
- goAuth(){
- PublicLib.Goto({Url:'user-realauth'});
- },
- //- 跳转我的
- user(){
- PublicLib.Goto({Url:'user-center'});
- },
- //- 跳转主页
- index(){
- PublicLib.Goto({Url:'index'});
- },
- //- 跳转消息
- notice(){
- PublicLib.Goto({Url:'notice-center'});
- },
- //- 我的订单
- rightbtn(){
- PublicLib.Goto({Url:'mall-deal-list'});
- }
-
- }
- });
- </script>
- </body>
- </html>
|