Commit d8fe7c27 authored by 黄奎's avatar 黄奎

Merge branch 'master' of http://gitlab.oytour.com/viitto/mallapp

parents fe4407fb 56c5a29f
<template> <template>
<view> <view>
<view v-if="showStart == true" style="width: 100vw; height: 100vh"> <view v-if="showStart == true" style="width: 100vw; height: 100vh">
<image <image :src="startData.PicUrl" mode="aspectFit" style="width: 100%; height: 100%; position: relative">
:src="startData.PicUrl" <view class="Startbtn" :style="{ top: pagePaddingBottom }" @click="startb">
mode="aspectFit" 跳过
style="width: 100%; height: 100%; position: relative" </view>
> </image>
<view </view>
class="Startbtn" <view v-if="myPageData.home_pages" v-show="showStart == false" :style="[myPageData.home_pages.navs[active].templateBg]">
:style="{ top: pagePaddingBottom }" <view class="content" :style="{
@click="startb"
>
跳过
</view>
</image>
</view>
<view
v-if="myPageData.home_pages"
v-show="showStart == false"
:style="[myPageData.home_pages.navs[active].templateBg]"
>
<view
class="content"
:style="{
'padding-bottom': showtabs == true ? boxpaddingbottom + 'px' : 0, 'padding-bottom': showtabs == true ? boxpaddingbottom + 'px' : 0,
paddingTop: pagePaddingBottom, paddingTop: pagePaddingBottom,
}" }">
> <view class="index-title" :class="{ MainTopLeft: pageTitleStr.length > 10 }" :style="[
<view
class="index-title"
:class="{ MainTopLeft: pageTitleStr.length > 10 }"
:style="[
myPageData.home_pages.navs[active].templateBg, myPageData.home_pages.navs[active].templateBg,
titleStyle, titleStyle,
{ {
...@@ -38,1423 +20,1283 @@ ...@@ -38,1423 +20,1283 @@
? myPageData.home_pages.navs[active].templateBg.titleColor ? myPageData.home_pages.navs[active].templateBg.titleColor
: '', : '',
}, },
]" ]">
> <text v-if="isNavPosition == 0">{{ pageTitleStr }}</text>
<text v-if="isNavPosition == 0">{{ pageTitleStr }}</text> <view v-if="isNavPosition == 1" style="width: 78%">
<view v-if="isNavPosition == 1" style="width: 78%"> <search :style-str="searchData"></search>
<search :style-str="searchData"></search> </view>
</view> <view class="back-arrow" v-if="showBack" @click="goback">
<view class="back-arrow" v-if="showBack" @click="goback"> <u-icon name="arrow-left" size="44"></u-icon>
<u-icon name="arrow-left" size="44"></u-icon> </view>
</view> </view>
</view> <u-tabs v-if="myPageData.home_pages && myPageData.home_pages.navs.length > 1" name="name" :list="myPageData.home_pages.navs"
<!-- <view @click='yj' style="width: 200px;height: 50px;">活动</view> --> :is-scroll="true" :active-color="mainColor" :current="active" :bar-width="80" :font-size="32" :bold="false"
<u-tabs @change="changeHandler"></u-tabs>
v-if="myPageData.home_pages && myPageData.home_pages.navs.length > 1" <template v-for="(item, i) in myPageData.home_pages.navs">
name="name" <view :key="i" v-if="active == i">
:list="myPageData.home_pages.navs" <template v-for="(d, di) in item.template.data">
:is-scroll="true" <search v-if="d.id == 'search' && isNavPosition == 0" :style-str="d.data" :key="di"></search>
:active-color="mainColor" <swiper v-if="d.id == 'banner'" :swipers="d.data" :key="di"></swiper>
:current="active" <empty v-if="d.id == 'empty'" :block="d.data" :key="di"></empty>
:bar-width="80" <rubik v-if="d.id == 'rubik'" :ad="d.data" :key="di"></rubik>
:font-size="32" <goods v-if="d.id == 'goods'" :goods="d.data" :key="di"></goods>
:bold="false" <notice v-if="d.id == 'notice'" :notice="d.data" :key="di"></notice>
@change="changeHandler" <gridnav v-if="d.id == 'nav'" :navs="d.data" :key="di"></gridnav>
></u-tabs> <pagetitle v-if="d.id == 'link'" :ts="d.data" :key="di"></pagetitle>
<template v-for="(item, i) in myPageData.home_pages.navs"> <videopage v-if="d.id == 'video'" :video="d.data" :key="di"></videopage>
<view :key="i" v-if="active == i"> <copyright v-if="d.id == 'copyright'" :cop="d.data" :key="di"></copyright>
<template v-for="(d, di) in item.template.data"> <checkin v-if="d.id == 'check-in'" :check="d.data" :key="di"></checkin>
<search <userbox v-if="d.id == 'user-info'" :ts="d.data" :key="di"></userbox>
v-if="d.id == 'search' && isNavPosition == 0" <view v-if="d.id == 'image-text'" class="imageText" :key="di">
:style-str="d.data" <view v-html="d.data.content"></view>
:key="di" </view>
></search> <userorder v-if="d.id == 'user-order'" :uo="d.data" :key="di"></userorder>
<swiper <mapi v-if="d.id == 'map'" :mapi="d.data" :key="di"></mapi>
v-if="d.id == 'banner'" <checkform v-if="d.id == 'form'" :forms="d.data" :key="di"></checkform>
:swipers="d.data" <addialog v-if="d.id == 'modal' && d.data.opened" :ads="d.data" :key="di"></addialog>
:key="di" <quicknav v-if="d.id == 'quick-nav' && d.data.navSwitch == 1" :navs="d.data" :key="di"></quicknav>
></swiper> <pingtuan v-if="d.id == 'pintuan'" :goods="d.data" :key="di"></pingtuan>
<empty v-if="d.id == 'empty'" :block="d.data" :key="di"></empty> <shopinfo v-if="d.id == 'shop-info'" :ad="d.data" :key="di" ref="son"></shopinfo>
<rubik v-if="d.id == 'rubik'" :ad="d.data" :key="di"></rubik> <guide v-if="d.id == 'drive-guide'" :info="d.data" ref="city"></guide>
<goods v-if="d.id == 'goods'" :goods="d.data" :key="di"></goods> <!-- 网课列表 -->
<notice <rgoods v-if="d.id == 'educationCustom'" :goods="d.data"></rgoods>
v-if="d.id == 'notice'" <!-- 资讯 -->
:notice="d.data" <argoods v-if="d.id == 'educationArticle'" :goods="d.data"></argoods>
:key="di" <!-- 最近学习组件 -->
></notice> <rstudy v-if="d.id == 'education'" :goods="d.data" ref="study"></rstudy>
<gridnav v-if="d.id == 'nav'" :navs="d.data" :key="di"></gridnav> <store v-if="d.id == 'reservestore'" :goods="d.data" :storeinfo="storeInfo"></store>
<pagetitle <!-- 线下服务商品 -->
v-if="d.id == 'link'" <sindex v-if="d.id == 'storeGoods'" :goods="d.data" :key="di"></sindex>
:ts="d.data" <!-- 老师列表 -->
:key="di" <educationteacher v-if="d.id == 'educationteacher'" :goods="d.data" :key="di"></educationteacher>
></pagetitle> <!--导航栏-->
<videopage <navpage v-if="d.id == 'nav-page'" :navs="d.data" :key="di"></navpage>
v-if="d.id == 'video'" <!-- 相亲的人物模板 -->
:video="d.data" <matchmaking v-if="d.id == 'miaiuser'" :navs="d.data" :key="di"></matchmaking>
:key="di" <!-- 相亲活动 -->
></videopage> <miaiactivitytype v-if="d.id == 'miaiactivitytype'" :goods="d.data"></miaiactivitytype>
<copyright <!-- 相亲活动自定义 -->
v-if="d.id == 'copyright'" <miaiactivityCustom v-if="d.id == 'miaiactivityCustom'" :goods="d.data"></miaiactivityCustom>
:cop="d.data" <!-- 瀑布流组件 -->
:key="di" <Pubu v-if="d.id == 'blindDatePPPlus'" :dataObj="d.data" @refresh="refreshPage"></Pubu>
></copyright> <!-- 首店活动插件 -->
<checkin <tradeActivity v-if="d.id == 'tradeActivity'" :dataObj="d.data" :pagePaddingBottom="pagePaddingBottom" @refresh="refreshPage"
v-if="d.id == 'check-in'" ref="tradeActive"></tradeActivity>
:check="d.data" </template>
:key="di" </view>
></checkin> </template>
<userbox <view class="contract_nav" v-if="GetMiniAppId().MallBaseId==5">
v-if="d.id == 'user-info'" <button class="Ma_nav-item" show-message-card="true" :send-message-path="currentParent" open-type="contact">
:ts="d.data" <img src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1644833656000_313.png" />
:key="di" </button>
></userbox> </view>
<view v-if="d.id == 'image-text'" class="imageText" :key="di"> <view v-if="showtabs == true">
<view v-html="d.data.content"></view> <tabbar></tabbar>
</view> </view>
<userorder
v-if="d.id == 'user-order'"
:uo="d.data"
:key="di"
></userorder>
<mapi v-if="d.id == 'map'" :mapi="d.data" :key="di"></mapi>
<checkform
v-if="d.id == 'form'"
:forms="d.data"
:key="di"
></checkform>
<addialog
v-if="d.id == 'modal' && d.data.opened"
:ads="d.data"
:key="di"
></addialog>
<quicknav
v-if="d.id == 'quick-nav' && d.data.navSwitch == 1"
:navs="d.data"
:key="di"
></quicknav>
<pingtuan
v-if="d.id == 'pintuan'"
:goods="d.data"
:key="di"
></pingtuan>
<shopinfo
v-if="d.id == 'shop-info'"
:ad="d.data"
:key="di"
ref="son"
></shopinfo>
<guide
v-if="d.id == 'drive-guide'"
:info="d.data"
ref="city"
></guide>
<!-- 网课列表 -->
<rgoods v-if="d.id == 'educationCustom'" :goods="d.data"></rgoods>
<!-- 资讯 -->
<argoods
v-if="d.id == 'educationArticle'"
:goods="d.data"
></argoods>
<!-- 最近学习组件 -->
<rstudy
v-if="d.id == 'education'"
:goods="d.data"
ref="study"
></rstudy>
<store
v-if="d.id == 'reservestore'"
:goods="d.data"
:storeinfo="storeInfo"
></store>
<!-- 线下服务商品 -->
<sindex
v-if="d.id == 'storeGoods'"
:goods="d.data"
:key="di"
></sindex>
<!-- 老师列表 -->
<educationteacher
v-if="d.id == 'educationteacher'"
:goods="d.data"
:key="di"
></educationteacher>
<!--导航栏-->
<navpage
v-if="d.id == 'nav-page'"
:navs="d.data"
:key="di"
></navpage>
<!-- 相亲的人物模板 -->
<matchmaking
v-if="d.id == 'miaiuser'"
:navs="d.data"
:key="di"
></matchmaking>
<!-- 相亲活动 -->
<miaiactivitytype
v-if="d.id == 'miaiactivitytype'"
:goods="d.data"
></miaiactivitytype>
<!-- 相亲活动自定义 -->
<miaiactivityCustom
v-if="d.id == 'miaiactivityCustom'"
:goods="d.data"
></miaiactivityCustom>
<!-- 瀑布流组件 -->
<Pubu
v-if="d.id == 'blindDatePPPlus'"
:dataObj="d.data"
@refresh="refreshPage"
></Pubu>
<!-- 首店活动插件 -->
<tradeActivity
v-if="d.id == 'tradeActivity'"
:dataObj="d.data"
:pagePaddingBottom="pagePaddingBottom"
@refresh="refreshPage"
ref="tradeActive"
></tradeActivity>
</template>
</view>
</template>
<view class="contract_nav" v-if="GetMiniAppId().MallBaseId==5">
<button
class="Ma_nav-item"
show-message-card="true"
:send-message-path="currentParent"
open-type="contact"
>
<img src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1644833656000_313.png" />
</button>
</view>
<view v-if="showtabs == true">
<tabbar></tabbar>
</view>
<view <view class="tips_t" v-if="
class="tips_t"
v-if="
add_show == 1 && add_show == 1 &&
JSON.stringify(setting) != '{}' && JSON.stringify(setting) != '{}' &&
setting.add_app_text != null setting.add_app_text != null
" "
:style="{ :style="{
'border-radius': setting.add_app_bg_radius + 'rpx', 'border-radius': setting.add_app_bg_radius + 'rpx',
opacity: setting.add_app_bg_transparency / 100, opacity: setting.add_app_bg_transparency / 100,
top: pagePaddingBottom, top: pagePaddingBottom,
}" }">
> <u-icon name="cross" color="#fff" @click="close"></u-icon>
<u-icon name="cross" color="#fff" @click="close"></u-icon> <view style="width: 1px; height: 20px; margin: 0 10px; background: #fff"></view>
<view <Text style="color: #fff">{{ setting.add_app_text }}</Text>
style="width: 1px; height: 20px; margin: 0 10px; background: #fff" <view class="triangle-up" :style="{ top: pagePaddingBottom }"></view>
></view> </view>
<Text style="color: #fff">{{ setting.add_app_text }}</Text> <coupon v-if="showCoupons" :coupon-message="couponMessage" :cform="ComeFrom" @goLook="goLook" @closeBtn="closeBtn"></coupon>
<view class="triangle-up" :style="{ top: pagePaddingBottom }"></view> <auth v-if="showAuth" @changeuserinfo="reloadUserinfo" @gbAuth="gbAuth"></auth>
</view> <official-account></official-account>
<coupon <orderPopup v-if="showorder" :orderPopupdata="orderPopupdata" @gosalesvolume="gosalesvolume" @closeBtn="closeBtn_order"></orderPopup>
v-if="showCoupons" </view>
:coupon-message="couponMessage" </view>
:cform="ComeFrom" </view>
@goLook="goLook"
@closeBtn="closeBtn"
></coupon>
<auth
v-if="showAuth"
@changeuserinfo="reloadUserinfo"
@gbAuth="gbAuth"
></auth>
<official-account></official-account>
<orderPopup
v-if="showorder"
:orderPopupdata="orderPopupdata"
@gosalesvolume="gosalesvolume"
@closeBtn="closeBtn_order"
></orderPopup>
</view>
</view>
</view>
</template> </template>
<script> <script>
import tabbar from "@/components/tabbar/index"; import tabbar from "@/components/tabbar/index";
import search from "@/components/search/index"; import search from "@/components/search/index";
import swiper from "@/components/swiper/index"; import swiper from "@/components/swiper/index";
import empty from "@/components/empty/index"; import empty from "@/components/empty/index";
import rubik from "@/components/rubik/index"; import rubik from "@/components/rubik/index";
import goods from "@/components/goods/index"; import goods from "@/components/goods/index";
import notice from "@/components/notice/index"; import notice from "@/components/notice/index";
import gridnav from "@/components/gridnav/index"; import gridnav from "@/components/gridnav/index";
import pagetitle from "@/components/pagetitle/index"; import pagetitle from "@/components/pagetitle/index";
import videopage from "@/components/videopage/index"; import videopage from "@/components/videopage/index";
import copyright from "@/components/copyright/index"; import copyright from "@/components/copyright/index";
import checkin from "@/components/checkin/index"; import checkin from "@/components/checkin/index";
import userbox from "@/components/userbox/index"; import userbox from "@/components/userbox/index";
import userorder from "@/components/userorder/index"; import userorder from "@/components/userorder/index";
import mapi from "@/components/mapi/index"; import mapi from "@/components/mapi/index";
import checkform from "@/components/checkform/index"; import checkform from "@/components/checkform/index";
import addialog from "@/components/addialog/index"; import addialog from "@/components/addialog/index";
import quicknav from "@/components/quicknav/index"; import quicknav from "@/components/quicknav/index";
import coupon from "@/components/coupons/coupons"; import coupon from "@/components/coupons/coupons";
import pingtuan from "@/components/pingtuan/index"; import pingtuan from "@/components/pingtuan/index";
import shopinfo from "@/components/shopinfo/shopinfo"; import shopinfo from "@/components/shopinfo/shopinfo";
import auth from "@/components/auth/index.vue"; import auth from "@/components/auth/index.vue";
import guide from "@/components/guidecar/index.vue"; import guide from "@/components/guidecar/index.vue";
import rstudy from "@/components/study/Rstudy.vue"; import rstudy from "@/components/study/Rstudy.vue";
import rgoods from "@/components/study/index.vue"; import rgoods from "@/components/study/index.vue";
import argoods from "@/components/studyArticle/index.vue"; import argoods from "@/components/studyArticle/index.vue";
import store from "@/components/store/store.vue"; import store from "@/components/store/store.vue";
import sindex from "@/components/store/index.vue"; import sindex from "@/components/store/index.vue";
import educationteacher from "@/components/educationteacher/index"; import educationteacher from "@/components/educationteacher/index";
import navpage from "@/components/navpage/index"; import navpage from "@/components/navpage/index";
import matchmaking from "@/components/matchmaking/index"; import matchmaking from "@/components/matchmaking/index";
import miaiactivitytype from "@/components/miaiactivitytype/index"; import miaiactivitytype from "@/components/miaiactivitytype/index";
import miaiactivityCustom from "@/components/miaiactivityCustom/index"; import miaiactivityCustom from "@/components/miaiactivityCustom/index";
import orderPopup from "@/components/coupons/orderPopup.vue"; //离线订单弹窗 import orderPopup from "@/components/coupons/orderPopup.vue"; //离线订单弹窗
import Pubu from "@/components/pubu/index.vue"; //瀑布流 import Pubu from "@/components/pubu/index.vue"; //瀑布流
import tradeActivity from "@/components/tradeActivity/index.vue"; //首店活动插件 import tradeActivity from "@/components/tradeActivity/index.vue"; //首店活动插件
const innerAudioContext = uni.createInnerAudioContext(); const innerAudioContext = uni.createInnerAudioContext();
export default { export default {
data() { data() {
return { return {
title: "Hello", title: "Hello",
myPageData: {}, myPageData: {},
indexPageData: {}, indexPageData: {},
mainColor: "", mainColor: "",
active: 0, active: 0,
contentHeight: 0, contentHeight: 0,
pageId: 0, pageId: 0,
setting: {}, setting: {},
add_show: 1, add_show: 1,
showtabs: true, showtabs: true,
showCoupons: false, showCoupons: false,
couponMessage: "", couponMessage: "",
pageTitleStr: "", pageTitleStr: "",
titleStyle: "", titleStyle: "",
pagePaddingBottom: "0px", pagePaddingBottom: "0px",
showBack: false, showBack: false,
showAuth: false, showAuth: false,
U: {}, U: {},
shopData: {}, shopData: {},
JumpType: 0, JumpType: 0,
GoodsId: 29, GoodsId: 29,
guidecar: {}, guidecar: {},
searchData: {}, //传递给search data searchData: {}, //传递给search data
isNavPosition: 0, //设置搜索框位置 isNavPosition: 0, //设置搜索框位置
IsOpenSchool: 0, IsOpenSchool: 0,
OrderId: 0, OrderId: 0,
storePosition: "", //线下服务获取经纬度 storePosition: "", //线下服务获取经纬度
storeInfo: {}, storeInfo: {},
fxstoreId: 0, //分享过来的门店id fxstoreId: 0, //分享过来的门店id
showStart: false, //是否显示启动页 showStart: false, //是否显示启动页
startData: {}, startData: {},
ComeFrom: "", ComeFrom: "",
cardsmoney: 0, //储值卡带过来的金额 cardsmoney: 0, //储值卡带过来的金额
orderPopupdata: {}, //离线收益的弹窗 orderPopupdata: {}, //离线收益的弹窗
showorder: false, //显示弹出 showorder: false, //显示弹出
carrierType: "", //载体type carrierType: "", //载体type
AppletID: 0, //判断小程序的id,相亲:11 AppletID: 0, //判断小程序的id,相亲:11
page_idt: 0, //首页组件分享参数 page_idt: 0, //首页组件分享参数
boxpaddingbottom: 0, //底部的高度 boxpaddingbottom: 0, //底部的高度
currentParent:'' currentParent: ''
}; };
}, },
components: { components: {
tabbar, tabbar,
search, search,
swiper, swiper,
empty, empty,
rubik, rubik,
goods, goods,
notice, notice,
gridnav, gridnav,
pagetitle, pagetitle,
videopage, videopage,
copyright, copyright,
checkin, checkin,
userbox, userbox,
userorder, userorder,
mapi, mapi,
checkform, checkform,
addialog, addialog,
quicknav, quicknav,
coupon, coupon,
pingtuan, pingtuan,
shopinfo, shopinfo,
auth, auth,
guide, guide,
rstudy, rstudy,
rgoods, rgoods,
argoods, argoods,
store, store,
sindex, sindex,
educationteacher, educationteacher,
navpage, navpage,
matchmaking, matchmaking,
miaiactivitytype, miaiactivitytype,
miaiactivityCustom, miaiactivityCustom,
orderPopup, orderPopup,
Pubu, Pubu,
tradeActivity, tradeActivity,
}, },
onLoad(options) { onLoad(options) {
let that = this; let that = this;
// that.yj() uni.getSystemInfo({
uni.getSystemInfo({ success(res) {
success(res) { that.titleStyle = {
that.titleStyle = { height: "45px",
height: "45px", paddingTop: `${res.statusBarHeight}px`,
paddingTop: `${res.statusBarHeight}px`, };
}; that.pagePaddingBottom = 45 + res.statusBarHeight + "px";
that.pagePaddingBottom = 45 + res.statusBarHeight + "px"; },
}, });
}); let c = this.$uiConfig.is_bang ? 78 : 50;
let c = this.$uiConfig.is_bang ? 78 : 50; this.boxpaddingbottom = c;
this.boxpaddingbottom = c; this.contentHeight = this.$utils.calcContentHeight(c);
this.contentHeight = this.$utils.calcContentHeight(c); if (options && options.page_id) {
if (options && options.page_id) { this.pageId = options.page_id;
this.pageId = options.page_id; let queryString = "";
let queryString = ""; for (var k in options) {
for (var k in options) { queryString += `&${k}=${options[k]}`;
queryString += `&${k}=${options[k]}`; }
} if (queryString != "") {
if (queryString != "") { queryString =
queryString = "/pages/index/index?" + queryString.substring(1, queryString.length);
"/pages/index/index?" + queryString.substring(1, queryString.length); }
} let p = 0;
let p = 0; if (uni.getStorageSync("navs")) {
if (uni.getStorageSync("navs")) { uni.getStorageSync("navs").forEach((x) => {
uni.getStorageSync("navs").forEach((x) => { if (x.url == queryString) {
if (x.url == queryString) { p = 1;
p = 1; }
} });
}); }
} if (p == 0) {
if (p == 0) { this.showtabs = false;
this.showtabs = false; this.contentHeight = this.$utils.calcContentHeight();
this.contentHeight = this.$utils.calcContentHeight(); }
} }
} let mall_UserInfo = uni.getStorageSync("mall_UserInfo");
let mall_UserInfo = uni.getStorageSync("mall_UserInfo"); if (options && options.Up) {
if (options && options.Up) { //校园id
//校园id uni.setStorageSync("Up", {
uni.setStorageSync("Up", { Up: options.Up,
Up: options.Up, });
}); this.IsOpenSchool = options.Up == 2 ? 1 : 0; //分享进来是否是校园模式
this.IsOpenSchool = options.Up == 2 ? 1 : 0; //分享进来是否是校园模式 }
} if (options && options.custom_params) {
if (options && options.custom_params) { let custom_params = JSON.parse(decodeURIComponent(options.custom_params));
let custom_params = JSON.parse(decodeURIComponent(options.custom_params)); if (custom_params.user_id) {
console.log(custom_params); uni.setStorageSync("pid", {
if (custom_params.user_id) { pid: custom_params.user_id,
uni.setStorageSync("pid", { });
pid: custom_params.user_id, }
}); if (custom_params.Up) {
} //校园id
if (custom_params.Up) { uni.setStorageSync("Up", {
//校园id Up: custom_params.Up,
uni.setStorageSync("Up", { });
Up: custom_params.Up, this.IsOpenSchool = custom_params.Up == 2 ? 1 : 0; //分享进来是否是校园模式
}); }
this.IsOpenSchool = custom_params.Up == 2 ? 1 : 0; //分享进来是否是校园模式 }
} if (mall_UserInfo && mall_UserInfo.UserPageType) {
} //进入页面时 判断登录缓存里是否是校园模式
if (mall_UserInfo && mall_UserInfo.UserPageType) { this.IsOpenSchool = mall_UserInfo.UserPageType == 2 ? 1 : 0;
//进入页面时 判断登录缓存里是否是校园模式 }
this.IsOpenSchool = mall_UserInfo.UserPageType == 2 ? 1 : 0; if (options && options.user_id) {
} uni.setStorageSync("pid", {
if (options && options.user_id) { pid: options.user_id,
uni.setStorageSync("pid", { });
pid: options.user_id, }
}); if (options && options.SmallShopId) {
} uni.setStorageSync("SmallShopId", {
if (options && options.SmallShopId) { SmallShopId: options.SmallShopId,
uni.setStorageSync("SmallShopId", { });
SmallShopId: options.SmallShopId, }
}); if (options && options.EduSchoolId) {
} uni.setStorageSync("EduSchoolId", {
if (options && options.EduSchoolId) { EduSchoolId: options.EduSchoolId,
uni.setStorageSync("EduSchoolId", { });
EduSchoolId: options.EduSchoolId, }
}); //从其他小程序跳转过来
} if (options && options.CounponPassword) {
//从其他小程序跳转过来 //小程序的来自
if (options && options.CounponPassword) { uni.setStorageSync("CounponPassword", {
//小程序的来自 CounponPassword: options.CounponPassword,
uni.setStorageSync("CounponPassword", { });
CounponPassword: options.CounponPassword, }
}); if (options && options.KeyWord) {
} //口令
if (options && options.KeyWord) { uni.setStorageSync("KeyWord", {
//口令 KeyWord: options.KeyWord,
uni.setStorageSync("KeyWord", { });
KeyWord: options.KeyWord, }
}); if (options && options.ComeFrom) {
} //跳过来的文字描述
if (options && options.ComeFrom) { this.ComeFrom = options.ComeFrom;
//跳过来的文字描述 uni.setStorageSync("ComeFrom", {
this.ComeFrom = options.ComeFrom; ComeFrom: options.ComeFrom,
uni.setStorageSync("ComeFrom", { });
ComeFrom: options.ComeFrom, }
}); if (options && options.scene) {
} //兼容之前小程序的调转
if (options && options.scene) { this.getjump(options.scene);
//兼容之前小程序的调转 }
this.getjump(options.scene); if (options && options.storeId) {
} this.fxstoreId = options.storeId;
if (options && options.storeId) { }
this.fxstoreId = options.storeId; if (options && options.type) {
} this.carrierType = options.type;
if (options && options.type) { }
this.carrierType = options.type;
} // #ifdef MP-WEIXIN
wx.showShareMenu({
withShareTicket: true,
menus: ["shareAppMessage", "shareTimeline"],
});
if (options && options.JumpType) {
//跳转类型 1为详情2为直播列表3为司导
this.JumpType = options.JumpType;
if (options.JumpType == 3) {
this.guidecar.GoodsId = options.GoodsId;
this.guidecar.address = options.address ?
JSON.parse(decodeURIComponent(options.address)) :
"";
this.guidecar.Pickcar = options.Pickcar ?
JSON.parse(decodeURIComponent(options.Pickcar)) :
"";
this.guidecar.StartTime = options.StartTime ? options.StartTime : "";
this.guidecar.EndTime = options.EndTime ? options.EndTime : "";
}
}
if (options && options.page_idt) {
this.page_idt = options.page_idt;
}
if (options && options.J) {
//司导分享的的特殊处理
this.JumpType = options.J;
if (options.J == 3) {
this.guidecar.GoodsId = options.i;
this.guidecar.address = options.address ?
JSON.parse(decodeURIComponent(options.address)) :
"";
this.guidecar.Pickcar = options.P ?
JSON.parse(decodeURIComponent(options.P)) :
"";
this.guidecar.StartTime = options.S ? options.S : "";
this.guidecar.EndTime = options.E ? options.E : "";
}
if (options && options.u) {
uni.setStorageSync("pid", {
pid: options.u,
});
}
if (options && options.m) {
uni.setStorageSync("SmallShopId", {
SmallShopId: options.m,
});
}
}
if (options && options.id) {
//商品详情
this.GoodsId = options.id;
} else {
this.GoodsId = options.GoodsId ? options.GoodsId : 29;
}
if (options && options.money) {
//储值卡
this.cardsmoney = options.money;
}
if (options && options.OrderId) {
//代付订单id
this.OrderId = options.OrderId;
}
that.u = uni.getStorageSync("mall_UserInfo");
if (!that.u) {
that.u = {
nickName: "未登录",
avatarUrl: "",
};
that.showAuth = true;
} else {
that.sharejump(); //4-9新加
this.handleChengShuang();
}
// #endif
let set = uni.getStorageSync("basedata") ?
uni.getStorageSync("basedata").mall.setting : {};
if (!uni.getStorageSync("add_top_app")) {
uni.setStorageSync("add_top_app", {
add_top_app_show: 1,
});
}
this.add_show = uni.getStorageSync("add_top_app") ?
uni.getStorageSync("add_top_app").add_top_app_show :
1;
this.setting = set;
this.isShowBack();
// #ifdef MP-WEIXIN let now = new Date();
wx.showShareMenu({ let nowtime =
withShareTicket: true, now.getFullYear() + "-" + (now.getMonth() + 1) + "-" + now.getDate();
menus: ["shareAppMessage", "shareTimeline"],
});
if (options && options.JumpType) {
//跳转类型 1为详情2为直播列表3为司导
this.JumpType = options.JumpType;
if (options.JumpType == 3) {
this.guidecar.GoodsId = options.GoodsId;
this.guidecar.address = options.address
? JSON.parse(decodeURIComponent(options.address))
: "";
this.guidecar.Pickcar = options.Pickcar
? JSON.parse(decodeURIComponent(options.Pickcar))
: "";
this.guidecar.StartTime = options.StartTime ? options.StartTime : "";
this.guidecar.EndTime = options.EndTime ? options.EndTime : "";
}
}
if (options && options.page_idt) {
this.page_idt = options.page_idt;
}
if (options && options.J) {
//司导分享的的特殊处理
this.JumpType = options.J; if (!uni.getStorageSync("Startup_page")) {
if (options.J == 3) { //获取启动页信息1、没有记录日期
this.guidecar.GoodsId = options.i; this.getstartModel(nowtime);
this.guidecar.address = options.address } else {
? JSON.parse(decodeURIComponent(options.address)) //记录日期和当天相差1天调取
: ""; let dayc = this.DateDiff(
this.guidecar.Pickcar = options.P uni.getStorageSync("Startup_page").time,
? JSON.parse(decodeURIComponent(options.P)) nowtime
: ""; );
this.guidecar.StartTime = options.S ? options.S : ""; if (dayc >= 1) {
this.guidecar.EndTime = options.E ? options.E : ""; this.getstartModel(nowtime);
} }
if (options && options.u) { }
uni.setStorageSync("pid", { //测试方法
pid: options.u, this.testJJSWApi();
}); uni.showNavigationBarLoading();
} },
if (options && options.m) { created() {
uni.setStorageSync("SmallShopId", { let pages = getCurrentPages(); //获取加载的页面
SmallShopId: options.m, let currentPage = pages[pages.length - 1]; //获取当前页面的对象
}); this.currentParent = currentPage.route; //当前页面url
} },
} // #ifdef MP-WEIXIN
if (options && options.id) { onShareTimeline() {
//商品详情 setTimeout(() => {
this.GoodsId = options.id; // console.log("分享调用");
} else { this.getReceive();
this.GoodsId = options.GoodsId ? options.GoodsId : 29; }, 2500);
} let uid = uni.getStorageSync("mall_UserInfo") ?
if (options && options.money) { uni.getStorageSync("mall_UserInfo").UserId :
//储值卡 0;
this.cardsmoney = options.money; if (uid == 0) {
} uid = uni.getStorageSync("pid") ? uni.getStorageSync("pid").pid : 0;
if (options && options.OrderId) { }
//代付订单id let SmallShopId = uni.getStorageSync("mall_UserInfo") ?
this.OrderId = options.OrderId; uni.getStorageSync("mall_UserInfo").SmallShopId :
} 0;
that.u = uni.getStorageSync("mall_UserInfo"); if (SmallShopId == 0) {
if (!that.u) { //如果微店id为0 去找所属微店id
that.u = { SmallShopId = uni.getStorageSync("mall_UserInfo") ?
nickName: "未登录", uni.getStorageSync("mall_UserInfo").UserSmallShopId :
avatarUrl: "", 0;
}; }
that.showAuth = true; let title = this.setting.share_title ?
} else { this.setting.share_title :
that.sharejump(); //4-9新加 uni.getStorageSync("basedata").mall.name;
this.handleChengShuang(); if (SmallShopId != 0) {
} title = this.shopData.Name;
//4-11这里暂时不能使用 }
// wx.getUserInfo({//4-9修改 不使用getUserInfo 会造成获取回来的微信默认名称和头像 let Up = uni.getStorageSync("mall_UserInfo") ?
// success: function(res) {//4-9之后的好像这里不能静默登录了需要弹出登录 uni.getStorageSync("mall_UserInfo").UserPageType :
// console.log(res,'getUserInfo') 0;
// if (uni.getStorageSync("mall_UserInfo")) { let path;
// let uid = uni.getStorageSync("mall_UserInfo").UserId; if (this.pageId > 0) {
// let msg = { //首页子组件的分享
// Id: uid, path =
// AliasName: res.userInfo.nickName, "user_id=" +
// Photo: res.userInfo.avatarUrl, uid +
// }; "&SmallShopId=" +
// that.updateuserinfo(msg); SmallShopId +
// that.getPageType() "&Up=" +
// // 如果登录的情况下直接跳转商品详情或者直播列表 Up +
// // that.sharejump(); "&page_idt=" +
// //如果登录状态 并且是uni.getStorageSync("CounponPassword") this.pageId +
// if(uni.getStorageSync("CounponPassword")){ "&JumpType=19";
// that.getunilogin(res) } else {
// } //首页分享
// } else { path = "user_id=" + uid + "&SmallShopId=" + SmallShopId + "&Up=" + Up;
// that.getunilogin(res) }
// }
// },
// fail: function(e) {
// uni.showToast({
// title: "微信登录授权失败",
// icon: "none"
// });
// }, return {
// }); title: title,
query: path,
imageUrl: "",
};
},
onShareAppMessage(res) {
setTimeout(() => {
// console.log("分享调用");
this.getReceive();
}, 2500);
let uid = uni.getStorageSync("mall_UserInfo") ?
uni.getStorageSync("mall_UserInfo").UserId :
0;
if (uid == 0) {
uid = uni.getStorageSync("pid") ? uni.getStorageSync("pid").pid : 0;
}
let SmallShopId = uni.getStorageSync("mall_UserInfo") ?
uni.getStorageSync("mall_UserInfo").SmallShopId :
0;
if (SmallShopId == 0) {
//如果微店id为0 去找所属微店id
SmallShopId = uni.getStorageSync("mall_UserInfo") ?
uni.getStorageSync("mall_UserInfo").UserSmallShopId :
0;
}
let title = this.setting.share_title ?
this.setting.share_title :
uni.getStorageSync("basedata").mall.name;
if (SmallShopId != 0) {
title = this.shopData.Name;
}
let Up = uni.getStorageSync("mall_UserInfo") ?
uni.getStorageSync("mall_UserInfo").UserPageType :
0;
let path;
if (this.pageId > 0) {
//首页子组件的分享
path =
"/pages/index/index?user_id=" +
uid +
"&SmallShopId=" +
SmallShopId +
"&Up=" +
Up +
"&page_idt=" +
this.pageId +
"&JumpType=19";
} else {
//首页分享
path =
"/pages/index/index?user_id=" +
uid +
"&SmallShopId=" +
SmallShopId +
"&Up=" +
Up;
}
return {
title: title,
path: path,
imageUrl: "",
};
},
// #endif
onShow() {
setTimeout(() => {
uni.hideNavigationBarLoading();
}, 500);
this.mainColor = this.$uiConfig.mainColor;
this.getIsOpenReserve();
//调用
if (Object.keys(this.$refs).length > 0 && this.$refs.tradeActive) {
//判断
this.$refs.tradeActive[0].getShow(); //调取最近学习组件的方法
}
},
methods: {
getunilogin(res) {
let that = this;
//静默登录操作
uni.login({
provider: "weixin",
success: (info) => {
let obj = {
Name: res.userInfo.nickName,
Photo: res.userInfo.avatarUrl,
code: info.code,
};
that.getCode(obj);
},
fail: () => {
uni.showToast({
title: "微信登录授权失败",
icon: "none",
});
if (!that.u) {
that.u = {
nickName: "未登录",
avatarUrl: "",
};
that.showAuth = true;
}
},
});
},
//获取IsOpenReserve
getIsOpenReserve() {
this.request2({
url: "/api/Mall/GetAppConfig",
data: {},
},
(res) => {
uni.setStorageSync("GetAppConfig", res.data); //方便在分类判断
if (res.resultCode == 1) {
if (res.data.IsOpenReserve == 1) {
this.getstore();
} else {
this.init();
}
} else {
this.init();
}
}
);
},
DateDiff(sDate1, sDate2) {
var aDate, oDate1, oDate2, iDays;
aDate = sDate1.split("-");
oDate1 = new Date(aDate[1] + "-" + aDate[2] + "-" + aDate[0]); //转换为9-25-2017格式
aDate = sDate2.split("-");
oDate2 = new Date(aDate[1] + "-" + aDate[2] + "-" + aDate[0]);
iDays = parseInt(Math.abs(oDate1 - oDate2) / 1000 / 60 / 60 / 24); //把相差的毫秒数转换为天数
return iDays;
},
getstartModel(time) {
this.request2({
url: "/api/AppletSchool/GetEducationStartUpModel",
data: {},
},
(res) => {
uni.setStorageSync("Startup_page", {
time: time
}); //方便在分类判断
if (res.resultCode == 1) {
if (res.data.IsShow == 1) {
this.showStart = true;
this.startData = res.data;
innerAudioContext.src = res.data.MusicUrl;
innerAudioContext.play();
setTimeout(() => {
this.showStart = false;
if (innerAudioContext != undefined) {
//判断下不是无法暂停
innerAudioContext.stop();
}
}, res.data.Seconds * 1000);
}
} else {}
}
);
},
startb() {
//跳过启动页
this.showStart = false;
if (innerAudioContext != undefined) {
//判断下不是无法暂停
innerAudioContext.stop();
}
},
getphonenumber(e) {
uni.checkSession({
//检查登录状态是否过期
success: (x) => {
if (x.errMsg == "checkSession:ok") {
//没有过期
console.log("没过期");
}
},
fail: (err) => {
//检测失败重新登录
console.log(err);
},
});
},
//调用获取code
getCode(obj) {
var that = this;
//这里请求接口
that.request2({
url: "/api/mall/GetWeChatOpenId",
data: {
Code: obj.code,
},
},
(res) => {
if (res.resultCode == 1) {
obj.OpenId = res.data;
that.getLogin(obj);
}
}
);
},
getLogin(obj) {
var that = this;
let pid = uni.getStorageSync("pid") ? uni.getStorageSync("pid").pid : 0;
let Up = uni.getStorageSync("Up") ? uni.getStorageSync("Up").Up : 0;
let SmallShopId = uni.getStorageSync("SmallShopId") ?
uni.getStorageSync("SmallShopId").SmallShopId :
0;
let CounponPassword = uni.getStorageSync("CounponPassword") ?
uni.getStorageSync("CounponPassword").CounponPassword :
0;
let KeyWord = uni.getStorageSync("KeyWord") ?
uni.getStorageSync("KeyWord").KeyWord :
"";
let EduSchoolId = uni.getStorageSync("EduSchoolId") ?
uni.getStorageSync("EduSchoolId").EduSchoolId :
0;
let EduId = uni.getStorageSync("jxhData") ?
uni.getStorageSync("jxhData").Id :
0;
that.request2({
url: "/api/AppletLogin/Login",
data: {
Source: 1,
OpenId: obj.OpenId,
Name: obj.Name,
Photo: obj.Photo,
Moblie: "",
SuperiorId: pid,
SmallShopId: SmallShopId,
UserPageType: Up,
CounponPassword: CounponPassword,
KeyWord: KeyWord,
EduSchoolId: EduSchoolId,
EduId: EduId,
},
},
(res) => {
if (res.resultCode == 1) {
uni.setStorageSync("mall_UserInfo", res.data);
if (res.couponResultCode == 1) {
that.showCoupons = true;
that.couponMessage = res.couponMessage;
}
that.u = res.data;
uni.removeStorageSync("pid");
uni.removeStorageSync("SmallShopId");
uni.removeStorageSync("Up");
uni.removeStorageSync("CounponPassword");
uni.removeStorageSync("KeyWord");
uni.removeStorageSync("EduSchoolId");
that.getPageType();
if (res.data.IsOpenSchool == 1) {
//校园开启
that.init();
}
// 如果登录的情况下直接跳转商品详情或者直播列表
that.sharejump();
} else {
if (!that.u) {
that.u = {
nickName: "未登录",
avatarUrl: "",
};
that.showAuth = true;
}
}
}
);
},
getorderPupop() {
let now = new Date();
let Month =
now.getMonth() + 1 < 10 ?
"0" + (now.getMonth() + 1) :
now.getMonth() + 1;
let day = now.getDate() < 10 ? "0" + now.getDate() : now.getDate();
let nowtime =
now.getFullYear() +
"-" +
Month +
"-" +
day +
" " +
now.getHours() +
":" +
now.getMinutes() +
":" +
now.getSeconds();
if (uni.getStorageSync("order_old_time")) {
let oldtime = uni.getStorageSync("order_old_time").time;
if (new Date(nowtime).getTime() != new Date(oldtime).getTime()) {
this.getUserOffline(nowtime, oldtime);
}
}
uni.setStorageSync("order_old_time", {
time: nowtime
}); //吧当前时间存起来
},
getUserOffline(now, old) {
this.request2({
url: "/api/AppletUser/GetUserOfflineEarningsInfo",
data: {
StartTime: old,
EndTime: now,
},
},
(res) => {
this.orderPopupdata = res.data;
if (this.orderPopupdata.State == 1) {
if (this.orderPopupdata.OrderNum > 0) {
this.showorder = true;
}
}
}
);
},
closeBtn_order() {
this.showorder = false;
},
gosalesvolume() {
this.showorder = false;
setTimeout(() => {
let UserId = uni.getStorageSync("mall_UserInfo") ?
uni.getStorageSync("mall_UserInfo").UserId :
0;
uni.navigateTo({
// url: "/pages/share/salesvolume?UserId="+UserId,
url: "/pages/share-order/share-order",
});
}, 10);
},
sharejump() {
//分享的总跳转
let that = this;
setTimeout(() => {
if (that.JumpType == 1) {
//商品详情
uni.navigateTo({
url: "/pages/goods/goods?GoodsId=" + that.GoodsId,
});
} else if (that.JumpType == 2) {
//直播列表
uni.navigateTo({
url: "/pages/live/index",
});
} else if (that.JumpType == 3) {
//司导详情
that.goguidecar();
} else if (that.JumpType == 4) {
//代付页面
uni.navigateTo({
url: "/pages/order/payment-order?GoodsId=" + that.OrderId,
});
} else if (that.JumpType == 5) {
//课程详情
uni.navigateTo({
url: "/pages/school/courseInfo?GoodsId=" + that.GoodsId,
});
} else if (that.JumpType == 6) {
//课程代付页面
uni.navigateTo({
url: "/pages/school/personal/payment-order?OrderId=" + that.OrderId,
});
} else if (that.JumpType == 7) {
//线下服务门店详情
// #endif uni.navigateTo({
url: "/pages/reserve/storeDetails?id=" + that.GoodsId,
});
} else if (that.JumpType == 8) {
//服务人员详情
uni.navigateTo({
url: "/pages/reserve/designerDetail?ID=" +
that.GoodsId +
"&storeId=" +
that.fxstoreId,
});
} else if (that.JumpType == 9) {
//线下服务商品
try {
uni.setStorageSync("storeId", {
storeId: that.fxstoreId
});
} catch (e) {
console.log(e);
}
uni.navigateTo({
url: "/pages/reserve/goodsDetails?GoodsId=" + that.GoodsId,
});
} else if (that.JumpType == 10) {
//拼拼push活动详情
uni.navigateTo({
url: "/pages/blindDate/postDetails?Id=" + that.GoodsId,
});
} else if (that.JumpType == 11) {
//用户详情
uni.navigateTo({
url: "/pages/blindDate/persondetails?UserId=" + that.GoodsId,
});
} else if (that.JumpType == 12) {
//储值卡的领取
uni.navigateTo({
url: "/pages/coupon/cards/cardsreceive?Id=" +
that.GoodsId +
"&cardsmoney=" +
this.cardsmoney,
});
} else if (that.JumpType == 13) {
//用户资料
uni.navigateTo({
url: "/pages/blindDate/persondetails?UserId=" + that.GoodsId,
});
} else if (that.JumpType == 14) {
//用户资料填写
uni.navigateTo({
url: "/pages/blindDate/editData"
});
} else if (that.JumpType == 15) {
//品牌详情
uni.navigateTo({
url: "/pages/kotra/brand/detail?id=" + that.GoodsId,
});
} else if (that.JumpType == 16) {
//载体详情
uni.navigateTo({
url: "/pages/kotra/carrier/detail?id=" +
that.GoodsId +
"&type=" +
that.carrierType,
});
} else if (that.JumpType == 17) {
//教育后台,广告二维码进入
// uni.navigateTo({ url: "/pages/kotra/carrier/detail?id=" + that.GoodsId+'&type='+that.carrierType});
} else if (that.JumpType == 18) {
//活动详情
uni.navigateTo({
url: "/pages/school/JIaheactivitydetails?Id=" + that.GoodsId,
});
} else if (that.JumpType == 19) {
that.JumpType = 0;
if (that.page_idt > 0) {
uni.navigateTo({
url: "/pages/index/index?page_id=" + that.page_idt,
});
}
} else if (that.JumpType == 20) {
//甲鹤的收据详情
uni.navigateTo({
url: "/pages/school/personal/receiptDetails?FinanceId=" + that.GoodsId,
});
}
}, 500);
},
updateuserinfo(msg) {
this.request2({
url: "/api/MemberUser/SetMemberPhoto",
data: msg,
},
(res) => {
//静默处理不做任何提示
},
(error) => {}
);
},
goback() {
uni.navigateBack({
delta: 1,
});
},
isShowBack() {
let navs = uni.getStorageSync("navs") ? uni.getStorageSync("navs") : [];
if (navs) {
let t = getCurrentPages();
let query = t[t.length - 1].__displayReporter.query;
let queryString = "";
for (var k in query) {
queryString += `&${k}=${query[k]}`;
}
if (queryString != "") {
queryString = "?" + queryString.substring(1, queryString.length);
}
let crtPath = "/" + t[t.length - 1].route + queryString;
let isExsit = false;
navs.forEach((x, i) => {
if (x.url == crtPath) {
isExsit = true;
}
});
this.showBack = !isExsit;
}
},
getjump(scene) {
let a = "YZnsGuRojCKBkb1siP3VwkhkPFvh-D"; //测试数据
this.request({
url: "",
data: {
r: "api/default/qr-code-parameter",
token: scene,
},
},
(res) => {
uni.setStorageSync("pid", {
pid: res.data.detail.user_id ? res.data.detail.user_id : 0,
}); //存储上级的id
let objurl = this.ObjectToUrl(res.data.detail.data);
uni.navigateTo({
url: "/" + res.data.detail.path + "?" + objurl,
});
}
);
},
ObjectToUrl(e, t) {
var n = "";
for (var i in e)
n += "&" + i + "=" + (t ? encodeURIComponent(e[i]) : e[i]);
return n.substr(1);
},
init() {
let mall_IsOpenSchool = uni.getStorageSync("mall_UserInfo") ?
uni.getStorageSync("mall_UserInfo").IsOpenSchool :
0;
let open_school = 0;
let set = uni.getStorageSync("basedata") if (this.IsOpenSchool == 1 && mall_IsOpenSchool == 1) {
? uni.getStorageSync("basedata").mall.setting //this.IsOpenSchool 通过分享进来的 是否是校园 1 是0不是 mall_IsOpenSchool缓存获取校园模式开启没有
: {}; open_school = 1;
if (!uni.getStorageSync("add_top_app")) { } else {
uni.setStorageSync("add_top_app", { open_school = 0;
add_top_app_show: 1, }
}); let storeId =
} uni.getStorageSync("storeId") && uni.getStorageSync("storeId").storeId ?
this.add_show = uni.getStorageSync("add_top_app") uni.getStorageSync("storeId").storeId :
? uni.getStorageSync("add_top_app").add_top_app_show 0;
: 1; this.request2({
this.setting = set; url: "/api/Mall/GetHome",
this.isShowBack(); data: {
page_id: this.pageId,
open_school: open_school,
StoreId: storeId,
},
},
(res) => {
this.$uiConfig.mainColor = res.data.mall.setting.mallStyle.main;
this.$uiConfig.secondary = res.data.mall.setting.mallStyle.secondary;
if (res.data.mall.setting.mallStyle.pricecolor) {
this.$uiConfig.pricecolor =
res.data.mall.setting.mallStyle.pricecolor;
}
this.indexPageData = res.data.home_pages.navs[0].template.data;
this.myPageData = res.data;
if (res.data.navbar.navs) {
uni.setStorageSync("navs", res.data.navbar.navs);
}
uni.setStorageSync("basedata", res.data);
// this.init(); if (Object.keys(this.$refs).length > 0 && this.$refs.study) {
let now = new Date(); //判断
let nowtime = this.$refs.study[0].getData(); //调取最近学习组件的方法
now.getFullYear() + "-" + (now.getMonth() + 1) + "-" + now.getDate(); }
// this.getIsOpenReserve();//4-11注释 if (
if (!uni.getStorageSync("Startup_page")) { this.myPageData.home_pages.navs.length > 0 &&
//获取启动页信息1、没有记录日期 this.myPageData.home_pages.navs[0].template.data.length > 0
this.getstartModel(nowtime); ) {
} else { this.myPageData.home_pages.navs[0].template.data.forEach((x) => {
//记录日期和当天相差1天调取 if (x.id == "search") {
let dayc = this.DateDiff( this.searchData = x.data;
uni.getStorageSync("Startup_page").time, this.isNavPosition = x.data.searchPosition;
nowtime if (this.isNavPosition == 1) {
); this.searchData.top = -5;
if (dayc >= 1) { this.searchData.left = 10;
this.getstartModel(nowtime); }
} } else if (x.id == "shop-info") {
} this.getSmallShopById();
uni.showNavigationBarLoading(); } else if (x.id == "miaiuser") {
}, //4-29新加 相亲模式随机的时候调用接口
created() { if (x.data.addUserType == 4) {
let pages = getCurrentPages(); //获取加载的页面 this.request2({
let currentPage = pages[pages.length - 1]; //获取当前页面的对象 url: "/api/AppletMiai/GetDailyRandomList",
this.currentParent = currentPage.route ;//当前页面url data: {
}, pageIndex: 1,
// #ifdef MP-WEIXIN pageSize: x.data.goodsLength,
onShareTimeline() { Sex: 0,
setTimeout(() => { },
// console.log("分享调用"); },
this.getReceive(); (Daily) => {
}, 2500); if (Daily.resultCode == 1) {
let uid = uni.getStorageSync("mall_UserInfo") x.data.list = Daily.data.pageData;
? uni.getStorageSync("mall_UserInfo").UserId }
: 0; }
if (uid == 0) { );
uid = uni.getStorageSync("pid") ? uni.getStorageSync("pid").pid : 0; }
} }
let SmallShopId = uni.getStorageSync("mall_UserInfo") });
? uni.getStorageSync("mall_UserInfo").SmallShopId }
: 0;
if (SmallShopId == 0) {
//如果微店id为0 去找所属微店id
SmallShopId = uni.getStorageSync("mall_UserInfo")
? uni.getStorageSync("mall_UserInfo").UserSmallShopId
: 0;
}
let title = this.setting.share_title
? this.setting.share_title
: uni.getStorageSync("basedata").mall.name;
if (SmallShopId != 0) {
title = this.shopData.Name;
}
let Up = uni.getStorageSync("mall_UserInfo")
? uni.getStorageSync("mall_UserInfo").UserPageType
: 0;
let path;
if (this.pageId > 0) {
//首页子组件的分享
path =
"user_id=" +
uid +
"&SmallShopId=" +
SmallShopId +
"&Up=" +
Up +
"&page_idt=" +
this.pageId +
"&JumpType=19";
} else {
//首页分享
path = "user_id=" + uid + "&SmallShopId=" + SmallShopId + "&Up=" + Up;
}
console.log(path);
return {
title: title,
query: path,
imageUrl: "",
};
},
onShareAppMessage(res) {
setTimeout(() => {
// console.log("分享调用");
this.getReceive();
}, 2500);
let uid = uni.getStorageSync("mall_UserInfo")
? uni.getStorageSync("mall_UserInfo").UserId
: 0;
if (uid == 0) {
uid = uni.getStorageSync("pid") ? uni.getStorageSync("pid").pid : 0;
}
let SmallShopId = uni.getStorageSync("mall_UserInfo")
? uni.getStorageSync("mall_UserInfo").SmallShopId
: 0;
if (SmallShopId == 0) {
//如果微店id为0 去找所属微店id
SmallShopId = uni.getStorageSync("mall_UserInfo")
? uni.getStorageSync("mall_UserInfo").UserSmallShopId
: 0;
}
let title = this.setting.share_title
? this.setting.share_title
: uni.getStorageSync("basedata").mall.name;
if (SmallShopId != 0) {
title = this.shopData.Name;
}
let Up = uni.getStorageSync("mall_UserInfo")
? uni.getStorageSync("mall_UserInfo").UserPageType
: 0;
let path;
if (this.pageId > 0) {
//首页子组件的分享
path =
"/pages/index/index?user_id=" +
uid +
"&SmallShopId=" +
SmallShopId +
"&Up=" +
Up +
"&page_idt=" +
this.pageId +
"&JumpType=19";
} else {
//首页分享
path =
"/pages/index/index?user_id=" +
uid +
"&SmallShopId=" +
SmallShopId +
"&Up=" +
Up;
}
return {
title: title,
path: path,
imageUrl: "",
};
},
// #endif
onShow() {
setTimeout(() => {
uni.hideNavigationBarLoading();
}, 500);
this.mainColor = this.$uiConfig.mainColor;
this.getIsOpenReserve();
//调用
if (Object.keys(this.$refs).length > 0 && this.$refs.tradeActive) {
//判断
this.$refs.tradeActive[0].getShow(); //调取最近学习组件的方法
console.log(this.$refs.tradeActive[0]);
}
},
methods: { if (res.data.home_pages.title != "") {
getunilogin(res) { if (this.pageId == 0) {
let that = this; uni.setNavigationBarTitle({
//静默登录操作 title: res.data.home_pages.title,
uni.login({ });
provider: "weixin", if (!this.shopData.Name || this.shopData.Name == "") {
success: (info) => { this.pageTitleStr = res.data.home_pages.title;
let obj = { }
Name: res.userInfo.nickName, } else {
Photo: res.userInfo.avatarUrl, uni.setNavigationBarTitle({
code: info.code, title: res.data.home_pages.navs[0].name,
}; });
that.getCode(obj); if (!this.shopData.Name || this.shopData.Name == "") {
}, this.pageTitleStr = res.data.home_pages.navs[0].name;
fail: () => { }
uni.showToast({ }
title: "微信登录授权失败", this.titleStyle.color = res.data.navbar.top_text_color;
icon: "none", this.titleStyle.backgroundColor =
}); res.data.navbar.top_background_color;
if (!that.u) { this.isShowBack();
that.u = { }
nickName: "未登录", this.formatBg();
avatarUrl: "", if (
}; this.u &&
that.showAuth = true; res.data.user_info &&
} res.data.user_info.openOfflineEarnings == 1
}, ) {
}); //判断是否登录 是否开启 进行离线收益的弹出
}, this.getorderPupop(); //4-9号新加
//获取IsOpenReserve }
getIsOpenReserve() { },
this.request2( (error) => {}
{ );
url: "/api/Mall/GetAppConfig",
data: {},
},
(res) => {
uni.setStorageSync("GetAppConfig", res.data); //方便在分类判断
if (res.resultCode == 1) {
if (res.data.IsOpenReserve == 1) {
this.getstore();
} else {
this.init();
}
} else {
this.init();
}
}
);
},
DateDiff(sDate1, sDate2) {
var aDate, oDate1, oDate2, iDays;
aDate = sDate1.split("-");
oDate1 = new Date(aDate[1] + "-" + aDate[2] + "-" + aDate[0]); //转换为9-25-2017格式
aDate = sDate2.split("-");
oDate2 = new Date(aDate[1] + "-" + aDate[2] + "-" + aDate[0]);
iDays = parseInt(Math.abs(oDate1 - oDate2) / 1000 / 60 / 60 / 24); //把相差的毫秒数转换为天数
return iDays;
},
getstartModel(time) {
this.request2(
{
url: "/api/AppletSchool/GetEducationStartUpModel",
data: {},
},
(res) => {
uni.setStorageSync("Startup_page", { time: time }); //方便在分类判断
if (res.resultCode == 1) {
if (res.data.IsShow == 1) {
this.showStart = true;
this.startData = res.data;
innerAudioContext.src = res.data.MusicUrl;
innerAudioContext.play();
setTimeout(() => {
this.showStart = false;
if (innerAudioContext != undefined) {
//判断下不是无法暂停
innerAudioContext.stop();
}
}, res.data.Seconds * 1000);
}
} else {
}
}
);
},
startb() {
//跳过启动页
this.showStart = false;
if (innerAudioContext != undefined) {
//判断下不是无法暂停
innerAudioContext.stop();
}
},
getphonenumber(e) {
console.log(e);
uni.checkSession({
//检查登录状态是否过期
success: (x) => { },
if (x.errMsg == "checkSession:ok") { //测试进阶后台方法
//没有过期 testJJSWApi() {
console.log("没过期"); var that = this;
} var testCmd = "";
}, var postMsg = {};
fail: (err) => {
//检测失败重新登录
console.log(err);
},
});
},
//调用获取code
getCode(obj) {
var that = this;
//这里请求接口
that.request2(
{
url: "/api/mall/GetWeChatOpenId",
data: {
Code: obj.code,
},
},
(res) => {
if (res.resultCode == 1) {
obj.OpenId = res.data;
that.getLogin(obj);
}
}
);
},
getLogin(obj) {
var that = this;
let pid = uni.getStorageSync("pid") ? uni.getStorageSync("pid").pid : 0;
let Up = uni.getStorageSync("Up") ? uni.getStorageSync("Up").Up : 0;
let SmallShopId = uni.getStorageSync("SmallShopId")
? uni.getStorageSync("SmallShopId").SmallShopId
: 0;
let CounponPassword = uni.getStorageSync("CounponPassword")
? uni.getStorageSync("CounponPassword").CounponPassword
: 0;
let KeyWord = uni.getStorageSync("KeyWord")
? uni.getStorageSync("KeyWord").KeyWord
: "";
let EduSchoolId = uni.getStorageSync("EduSchoolId")
? uni.getStorageSync("EduSchoolId").EduSchoolId
: 0;
let EduId = uni.getStorageSync("jxhData")
? uni.getStorageSync("jxhData").Id
: 0;
that.request2(
{
url: "/api/AppletLogin/Login",
data: {
Source: 1,
OpenId: obj.OpenId,
Name: obj.Name,
Photo: obj.Photo,
Moblie: "",
SuperiorId: pid,
SmallShopId: SmallShopId,
UserPageType: Up,
CounponPassword: CounponPassword,
KeyWord: KeyWord,
EduSchoolId: EduSchoolId,
EduId:EduId,
},
},
(res) => {
if (res.resultCode == 1) {
uni.setStorageSync("mall_UserInfo", res.data);
if (res.couponResultCode == 1) {
that.showCoupons = true;
that.couponMessage = res.couponMessage;
}
that.u = res.data;
uni.removeStorageSync("pid");
uni.removeStorageSync("SmallShopId");
uni.removeStorageSync("Up");
uni.removeStorageSync("CounponPassword");
uni.removeStorageSync("KeyWord");
uni.removeStorageSync("EduSchoolId");
that.getPageType();
if (res.data.IsOpenSchool == 1) {
//校园开启
that.init();
}
// 如果登录的情况下直接跳转商品详情或者直播列表
that.sharejump();
} else {
if (!that.u) {
that.u = {
nickName: "未登录",
avatarUrl: "",
};
that.showAuth = true;
}
}
}
);
},
getorderPupop() {
let now = new Date();
let Month =
now.getMonth() + 1 < 10
? "0" + (now.getMonth() + 1)
: now.getMonth() + 1;
let day = now.getDate() < 10 ? "0" + now.getDate() : now.getDate();
let nowtime =
now.getFullYear() +
"-" +
Month +
"-" +
day +
" " +
now.getHours() +
":" +
now.getMinutes() +
":" +
now.getSeconds();
if (uni.getStorageSync("order_old_time")) {
let oldtime = uni.getStorageSync("order_old_time").time;
if (new Date(nowtime).getTime() != new Date(oldtime).getTime()) {
this.getUserOffline(nowtime, oldtime);
}
}
uni.setStorageSync("order_old_time", { time: nowtime }); //吧当前时间存起来
},
getUserOffline(now, old) {
this.request2(
{
url: "/api/AppletUser/GetUserOfflineEarningsInfo",
data: {
StartTime: old,
EndTime: now,
},
},
(res) => {
this.orderPopupdata = res.data;
if (this.orderPopupdata.State == 1) {
if (this.orderPopupdata.OrderNum > 0) {
this.showorder = true;
}
}
}
);
},
closeBtn_order() {
this.showorder = false;
},
gosalesvolume() {
this.showorder = false;
setTimeout(() => {
let UserId = uni.getStorageSync("mall_UserInfo")
? uni.getStorageSync("mall_UserInfo").UserId
: 0;
uni.navigateTo({
// url: "/pages/share/salesvolume?UserId="+UserId,
url: "/pages/share-order/share-order",
});
}, 10);
},
sharejump() {
//分享的总跳转
let that = this;
setTimeout(() => {
if (that.JumpType == 1) {
//商品详情
uni.navigateTo({
url: "/pages/goods/goods?GoodsId=" + that.GoodsId,
});
} else if (that.JumpType == 2) {
//直播列表
uni.navigateTo({
url: "/pages/live/index",
});
} else if (that.JumpType == 3) {
//司导详情
that.goguidecar();
} else if (that.JumpType == 4) {
//代付页面
uni.navigateTo({
url: "/pages/order/payment-order?GoodsId=" + that.OrderId,
});
} else if (that.JumpType == 5) {
//课程详情
uni.navigateTo({
url: "/pages/school/courseInfo?GoodsId=" + that.GoodsId,
});
} else if (that.JumpType == 6) {
//课程代付页面
uni.navigateTo({
url: "/pages/school/personal/payment-order?OrderId=" + that.OrderId,
});
} else if (that.JumpType == 7) {
//线下服务门店详情
uni.navigateTo({ //获取就读学校 开始
url: "/pages/reserve/storeDetails?id=" + that.GoodsId, testCmd = "/api/WeChatPublic/GetStuSchoolClass";
}); postMsg = {
} else if (that.JumpType == 8) { Type: 1
//服务人员详情 };
uni.navigateTo({ //获取就读学校 结束
url:
"/pages/reserve/designerDetail?ID=" +
that.GoodsId +
"&storeId=" +
that.fxstoreId,
});
} else if (that.JumpType == 9) {
//线下服务商品
try {
uni.setStorageSync("storeId", { storeId: that.fxstoreId });
} catch (e) {
console.log(e);
}
uni.navigateTo({
url: "/pages/reserve/goodsDetails?GoodsId=" + that.GoodsId,
});
} else if (that.JumpType == 10) {
//拼拼push活动详情
uni.navigateTo({
url: "/pages/blindDate/postDetails?Id=" + that.GoodsId,
});
} else if (that.JumpType == 11) {
//用户详情
uni.navigateTo({
url: "/pages/blindDate/persondetails?UserId=" + that.GoodsId,
});
} else if (that.JumpType == 12) {
//储值卡的领取
uni.navigateTo({
url:
"/pages/coupon/cards/cardsreceive?Id=" +
that.GoodsId +
"&cardsmoney=" +
this.cardsmoney,
});
} else if (that.JumpType == 13) {
//用户资料
uni.navigateTo({
url: "/pages/blindDate/persondetails?UserId=" + that.GoodsId,
});
} else if (that.JumpType == 14) {
//用户资料填写
uni.navigateTo({ url: "/pages/blindDate/editData" });
} else if (that.JumpType == 15) {
//品牌详情
uni.navigateTo({
url: "/pages/kotra/brand/detail?id=" + that.GoodsId,
});
} else if (that.JumpType == 16) {
//载体详情
uni.navigateTo({
url:
"/pages/kotra/carrier/detail?id=" +
that.GoodsId +
"&type=" +
that.carrierType,
});
} else if (that.JumpType == 17) {
//教育后台,广告二维码进入
// uni.navigateTo({ url: "/pages/kotra/carrier/detail?id=" + that.GoodsId+'&type='+that.carrierType});
} else if (that.JumpType == 18) {
//活动详情
uni.navigateTo({
url: "/pages/school/JIaheactivitydetails?Id=" + that.GoodsId,
});
} else if (that.JumpType == 19) {
that.JumpType = 0;
if (that.page_idt > 0) {
uni.navigateTo({
url: "/pages/index/index?page_id=" + that.page_idt,
});
}
} else if (that.JumpType == 20) {
//甲鹤的收据详情
uni.navigateTo({
url:
"/pages/school/personal/receiptDetails?FinanceId=" + that.GoodsId,
});
}
}, 500);
},
updateuserinfo(msg) {
this.request2(
{
url: "/api/MemberUser/SetMemberPhoto",
data: msg,
},
(res) => {
//静默处理不做任何提示
},
(error) => {}
);
},
goback() {
uni.navigateBack({
delta: 1,
});
},
isShowBack() {
let navs = uni.getStorageSync("navs") ? uni.getStorageSync("navs") : [];
if (navs) {
let t = getCurrentPages();
let query = t[t.length - 1].__displayReporter.query;
let queryString = "";
for (var k in query) {
queryString += `&${k}=${query[k]}`;
}
if (queryString != "") {
queryString = "?" + queryString.substring(1, queryString.length);
}
let crtPath = "/" + t[t.length - 1].route + queryString;
let isExsit = false;
navs.forEach((x, i) => {
if (x.url == crtPath) {
isExsit = true;
}
});
this.showBack = !isExsit;
}
},
getjump(scene) {
let a = "YZnsGuRojCKBkb1siP3VwkhkPFvh-D"; //测试数据
this.request(
{
url: "",
data: {
r: "api/default/qr-code-parameter",
token: scene,
},
},
(res) => {
console.log(res.data.detail.path);
uni.setStorageSync("pid", {
pid: res.data.detail.user_id ? res.data.detail.user_id : 0,
}); //存储上级的id
let objurl = this.ObjectToUrl(res.data.detail.data);
uni.navigateTo({
url: "/" + res.data.detail.path + "?" + objurl,
});
}
);
},
ObjectToUrl(e, t) {
var n = "";
for (var i in e)
n += "&" + i + "=" + (t ? encodeURIComponent(e[i]) : e[i]);
return n.substr(1);
},
init() {
let mall_IsOpenSchool = uni.getStorageSync("mall_UserInfo")
? uni.getStorageSync("mall_UserInfo").IsOpenSchool
: 0;
let open_school = 0;
if (this.IsOpenSchool == 1 && mall_IsOpenSchool == 1) { //获取年级 开始
//this.IsOpenSchool 通过分享进来的 是否是校园 1 是0不是 mall_IsOpenSchool缓存获取校园模式开启没有 testCmd = "/api/WeChatPublic/GetStuSchoolClass";
open_school = 1; postMsg = {
} else { Type: 2
open_school = 0; };
} //获取年级 结束
let storeId =
uni.getStorageSync("storeId") && uni.getStorageSync("storeId").storeId
? uni.getStorageSync("storeId").storeId
: 0;
this.request2(
{
url: "/api/Mall/GetHome",
data: {
page_id: this.pageId,
open_school: open_school,
StoreId: storeId,
},
},
(res) => {
this.$uiConfig.mainColor = res.data.mall.setting.mallStyle.main;
this.$uiConfig.secondary = res.data.mall.setting.mallStyle.secondary;
if (res.data.mall.setting.mallStyle.pricecolor) {
this.$uiConfig.pricecolor =
res.data.mall.setting.mallStyle.pricecolor;
}
this.indexPageData = res.data.home_pages.navs[0].template.data;
this.myPageData = res.data;
if (res.data.navbar.navs) {
uni.setStorageSync("navs", res.data.navbar.navs);
}
uni.setStorageSync("basedata", res.data);
if (Object.keys(this.$refs).length > 0 && this.$refs.study) { //获取校区 开始
//判断 testCmd = "/api/WeChatPublic/GetSchoolList"
this.$refs.study[0].getData(); //调取最近学习组件的方法 postMsg = {}
} //获取校区 结束
if (
this.myPageData.home_pages.navs.length > 0 &&
this.myPageData.home_pages.navs[0].template.data.length > 0
) {
this.myPageData.home_pages.navs[0].template.data.forEach((x) => {
if (x.id == "search") {
this.searchData = x.data;
this.isNavPosition = x.data.searchPosition;
if (this.isNavPosition == 1) {
this.searchData.top = -5;
this.searchData.left = 10;
}
} else if (x.id == "shop-info") {
this.getSmallShopById();
} else if (x.id == "miaiuser") {
//4-29新加 相亲模式随机的时候调用接口
if (x.data.addUserType == 4) {
this.request2(
{
url: "/api/AppletMiai/GetDailyRandomList",
data: {
pageIndex: 1,
pageSize: x.data.goodsLength,
Sex: 0,
},
},
(Daily) => {
if (Daily.resultCode == 1) {
x.data.list = Daily.data.pageData;
}
}
);
}
}
});
}
if (res.data.home_pages.title != "") { //学生注册
if (this.pageId == 0) { // testCmd="/api/WeChatPublic/CreateStudent";
uni.setNavigationBarTitle({ // postMsg={
title: res.data.home_pages.title, // OpenId:"oyiQo5OrTpUFPlKO9jluvr2KLl50",// openId 是 [string] 查看
}); // UnionId:"oV5Rm1J_MpkEVvE0VPEicwCDG1Zo",
if (!this.shopData.Name || this.shopData.Name == "") { // StuSex:"0",// 学生性别 0男 1女 是 [string] 查看
this.pageTitleStr = res.data.home_pages.title; // StuName:"HK测试",// 学生姓名 是 [string] 查看
} // StuBirth:"1990-09-09",// 学生生日 是 [string] 查看
} else { // StuTel:"13551126755",// 手机号码 是 [string] 查看
uni.setNavigationBarTitle({ // BaseCondition:"大面小学",// 就读学校 是 [string] 查看
title: res.data.home_pages.navs[0].name, // DemandPoint:"11",// 班级 是 [string] 查看
}); // ConsultingResults:"网上",// 如何知道进阶思维 是 [string] 查看
if (!this.shopData.Name || this.shopData.Name == "") { // School_Id:"1",// 校区 是 [string]
this.pageTitleStr = res.data.home_pages.navs[0].name; // Group_Id:"100001"
} // }
} //学生注册结束
// uni.setNavigationBarColor({ //获取校区 开始
// //字体颜色 testCmd = "/api/WeChatPublic/GetStuList"
// frontColor: res.data.navbar.top_text_color, postMsg = {
// //背景颜色 UnionId: "oV5Rm1J_MpkEVvE0VPEicwCDG1Zo"
// backgroundColor: res.data.navbar.top_background_color, }
// }); //获取校区 结束
this.titleStyle.color = res.data.navbar.top_text_color;
this.titleStyle.backgroundColor =
res.data.navbar.top_background_color;
this.isShowBack(); //这里请求接口
} that.requestJJSWAdmin(testCmd, postMsg,
this.formatBg(); (res) => {
if ( console.log("testJJSWApi", res)
this.u && });
res.data.user_info && },
res.data.user_info.openOfflineEarnings == 1 getstore() {
) { let that = this;
//判断是否登录 是否开启 进行离线收益的弹出 uni.getLocation({
this.getorderPupop(); //4-9号新加 type: "wgs84",
} success: function(res) {
}, let position = res.latitude + "," + res.longitude;
(error) => {} uni.setStorageSync("position", {
); position: position,
}, });
getstore() { that.getCurrentStore();
let that = this; },
uni.getLocation({ fail: function(err) {
type: "wgs84", that.getCurrentStore();
success: function (res) { },
let position = res.latitude + "," + res.longitude; });
uni.setStorageSync("position", { },
position: position, getCurrentStore() {
}); let storeId =
that.getCurrentStore(); uni.getStorageSync("storeId") && uni.getStorageSync("storeId").storeId ?
}, uni.getStorageSync("storeId").storeId :
fail: function (err) { 0;
that.getCurrentStore(); let position =
}, uni.getStorageSync("position") &&
}); uni.getStorageSync("position").position ?
}, uni.getStorageSync("position").position :
getCurrentStore() { "";
let storeId =
uni.getStorageSync("storeId") && uni.getStorageSync("storeId").storeId
? uni.getStorageSync("storeId").storeId
: 0;
let position =
uni.getStorageSync("position") &&
uni.getStorageSync("position").position
? uni.getStorageSync("position").position
: "";
this.request2( this.request2({
{ url: "/api/AppletStores/GetCurrentStore",
url: "/api/AppletStores/GetCurrentStore", data: {
data: { storeId: storeId,
storeId: storeId, position: position,
position: position, },
}, },
}, (res) => {
(res) => { if (res.data && res.data.storeInfo) {
if (res.data && res.data.storeInfo) { this.storeInfo = res.data.storeInfo;
this.storeInfo = res.data.storeInfo; uni.setStorageSync("storeId", {
uni.setStorageSync("storeId", { storeId: res.data.storeInfo.storeId,
storeId: res.data.storeInfo.storeId, });
}); if (res.data.storeInfo.storeId && res.data.storeInfo.storeId > 0) {
if (res.data.storeInfo.storeId && res.data.storeInfo.storeId > 0) { setTimeout((x) => {
setTimeout((x) => { this.init();
this.init(); }, 1000);
}, 1000); }
} }
} }
} );
); },
}, getSmallShopById() {
getSmallShopById() { let Id = uni.getStorageSync("mall_UserInfo") ?
let Id = uni.getStorageSync("mall_UserInfo") uni.getStorageSync("mall_UserInfo").SmallShopId :
? uni.getStorageSync("mall_UserInfo").SmallShopId 0;
: 0; if (Id == 0) {
if (Id == 0) { Id = uni.getStorageSync("mall_UserInfo") ?
Id = uni.getStorageSync("mall_UserInfo") uni.getStorageSync("mall_UserInfo").UserSmallShopId :
? uni.getStorageSync("mall_UserInfo").UserSmallShopId 0;
: 0; }
} this.request2({
this.request2( url: "/api/AppletUser/GetSmallShopById",
{ data: {
url: "/api/AppletUser/GetSmallShopById", Id: Id,
data: { },
Id: Id, },
}, (res) => {
}, if (res.resultCode == 1) {
(res) => { this.shopData = res.data;
if (res.resultCode == 1) { if (this.shopData.Name && this.shopData.Name != "") {
this.shopData = res.data; this.pageTitleStr = this.shopData.Name;
if (this.shopData.Name && this.shopData.Name != "") { }
this.pageTitleStr = this.shopData.Name; }
} }
} );
} },
); close() {
}, this.add_show = 2;
close() { uni.setStorageSync("add_top_app", {
this.add_show = 2; add_top_app_show: 2,
uni.setStorageSync("add_top_app", { });
add_top_app_show: 2, },
}); changeHandler(i) {
}, this.active = i;
changeHandler(i) { },
this.active = i; formatBg() {
}, this.myPageData.home_pages.navs.forEach((y) => {
formatBg() { y.template.data.forEach((x) => {
this.myPageData.home_pages.navs.forEach((y) => { if (x.id == "background") {
y.template.data.forEach((x) => { let t = "";
if (x.id == "background") { y.templateBg = {};
let t = ""; if (x.data.showImg) {
y.templateBg = {}; y.templateBg.backgroundColor = x.data.backgroundColor;
if (x.data.showImg) { y.templateBg.backgroundImage = `url('${x.data.backgroundPicUrl}')`;
y.templateBg.backgroundColor = x.data.backgroundColor; y.templateBg.backgroundPosition = x.data.positionText;
y.templateBg.backgroundImage = `url('${x.data.backgroundPicUrl}')`; y.templateBg.backgroundRepeat = x.data.repeatText ?
y.templateBg.backgroundPosition = x.data.positionText; x.data.repeatText :
y.templateBg.backgroundRepeat = x.data.repeatText "no-repeat";
? x.data.repeatText y.templateBg.backgroundSize =
: "no-repeat"; `${
y.templateBg.backgroundSize = `${
x.data.backgroundWidth == 0 x.data.backgroundWidth == 0
? "auto" ? "auto"
: x.data.backgroundWidth + "%" : x.data.backgroundWidth + "%"
...@@ -1463,312 +1305,238 @@ export default { ...@@ -1463,312 +1305,238 @@ export default {
? "auto" ? "auto"
: x.data.backgroundHeight + "%" : x.data.backgroundHeight + "%"
}`; }`;
} else { } else {
y.templateBg.background = x.data.backgroundColor; y.templateBg.background = x.data.backgroundColor;
y.templateBg.titleColor = "#000 !important"; y.templateBg.titleColor = "#000 !important";
} }
if (this.myPageData.home_pages.navs.length > 1) { if (this.myPageData.home_pages.navs.length > 1) {
y.templateBg.overflowY = "auto"; y.templateBg.overflowY = "auto";
y.templateBg.height = this.contentHeight + "px"; y.templateBg.height = this.contentHeight + "px";
} else { } else {
y.templateBg.overflowY = "auto"; y.templateBg.overflowY = "auto";
y.templateBg.height = this.contentHeight + 40 + "px"; y.templateBg.height = this.contentHeight + 40 + "px";
} }
if (x.data.titleColor) { if (x.data.titleColor) {
y.templateBg.titleColor = x.data.titleColor + " !important"; y.templateBg.titleColor = x.data.titleColor + " !important";
} }
// y.templateBg +="padding-bottom:"+(this.$uiConfig.is_bang ? '88px' : '60px')+";box-sizing: border-box;"; }
} });
}); if (!y.templateBg) {
if (!y.templateBg) { y.templateBg = {
y.templateBg = { titleColor: "#000",
titleColor: "#000", };
}; }
} });
}); },
// this.myPageData.home_pages.navs[0].template.data.push({ getReceive() {
// id: "pintuan", //分享进入调取领券接口
// permission_key: "pintuan", // 1-分享,2-购买并付款
// data: { this.request2({
// buttonColor: "#ff4544", url: "/api/AppletUser/ShareCoupon",
// list: [ data: {
// { TriggerType: 1,
// id: 179402, },
// name: },
// "日本POLA宝丽黑BA限定小礼盒(黑ba水20ml +黑ba乳液15ml +黑ba面霜5g +黑ba唇颊膏2g)", (res) => {
// picUrl: if (res.couponResultCode == 1) {
// "https://cdnimg.iotweixin.com/uploads/mall1285/20200506/904171cab7db2201f6f35c0ca5bb0a93.png", this.couponMessage = res.couponMessage;
// price: "388.00", this.showCoupons = true;
// peopleNum: 2, }
// pintuanPrice: "348.00", }
// }, );
// { },
// id: 178355, goLook() {
// name: this.showCoupons = false;
// "日本珂润(Curel)润浸保湿 滋养乳霜 40g 敏感肌专用 神经酰胺护理 抵抗外部刺激", },
// picUrl: closeBtn() {
// "https://cdnimg.iotweixin.com/uploads/mall1285/20200503/979653726a7bc1df0e24464f94b404bd.jpg", this.showCoupons = false;
// price: "180.00", },
// peopleNum: 2, reloadUserinfo() {
// pintuanPrice: "180.00", this.u = uni.getStorageSync("mall_UserInfo");
// }, if (this.$refs.son) {
// { this.$refs.son[0].getSmallShopById(2); //第一次登陆成功后去调取微店的信息
// id: 178352, }
// name: "500g 干羊肚菌 干货 煲汤菌 菌中之王 包邮", this.getPageType(); //获取用户类型(校园)
// picUrl: let IsOpenMiAi = uni.getStorageSync("basedata") ?
// "https://cdnimg.iotweixin.com/uploads/mall1285/20200311/358dd9acf5dafd3cab2c05be3354400c.png", uni.getStorageSync("basedata").mall.setting.is_show_miai :
// price: "780.00", 0; //是否开启相亲模式 5-13新加
// peopleNum: 3, if (this.u.IsOpenSchool == 1 || IsOpenMiAi == 1) {
// pintuanPrice: "680.00", this.init();
// }, }
// ], // 如果登录的情况下直接跳转商品详情或者直播列表
// listStyle: 1, this.sharejump();
// textStyle: 1, },
// fill: 1, getPageType() {
// goodsCoverProportion: "1-1", this.request2({
// goodsStyle: 1, url: "/api/AppletUser/GetAppletUserPageType",
// showGoodsName: true, data: {},
// showBuyBtn: true, },
// buyBtnStyle: 1, (res) => {
// buyBtnText: "去拼团", let mall_UserInfo = uni.getStorageSync("mall_UserInfo") ?
// showGoodsTag: false, uni.getStorageSync("mall_UserInfo") : {};
// customizeGoodsTag: false, mall_UserInfo.IsOpenSchool = res.data.IsOpenSchool;
// goodsTagPicUrl: "", mall_UserInfo.UserPageType = res.data.UserPageType;
// showImg: false, uni.setStorageSync("mall_UserInfo", mall_UserInfo);
// backgroundColor: "#fff", if (this.IsOpenSchool == 1 && res.data.UserPageType != 2) {
// backgroundPicUrl: "", //这种情况是自己注册过 但是 通过分享进来的判断
// position: 5, this.IsOpenSchool = 0;
// mode: 1, this.init();
// backgroundHeight: 100, }
// backgroundWidth: 100, }
// borderBackground: "#ffffff", );
// }, },
// }); //关闭登录窗口
}, gbAuth() {
getReceive() { this.showAuth = false;
//分享进入调取领券接口 },
// 1-分享,2-购买并付款 goguidecar() {
this.request2( uni.navigateTo({
{ url: "/pages/guidecar/guidecarGoodsdetails?GoodsId=" +
url: "/api/AppletUser/ShareCoupon", this.guidecar.GoodsId +
data: { "&address=" +
TriggerType: 1, this.guidecar.address +
}, "&Pickcar=" +
}, this.guidecar.Pickcar +
(res) => { "&StartTime=" +
console.log(res, "res"); this.guidecar.StartTime +
if (res.couponResultCode == 1) { "&EndTime=" +
this.couponMessage = res.couponMessage; this.guidecar.EndTime,
this.showCoupons = true; });
} },
} getPickcar(Name) {
); //选择取消地址
}, this.$refs.city[0].getPickcar(Name);
goLook() { },
this.showCoupons = false; refreshPage() {
},
closeBtn() { },
this.showCoupons = false; //橙霜---未认证跳转到引导页
}, handleChengShuang() {
reloadUserinfo() { let AppletID = this.GetMiniAppId().TenantId;
this.u = uni.getStorageSync("mall_UserInfo"); if (AppletID === 24) {
if (this.$refs.son) { let basedata = wx.getStorageSync("basedata");
this.$refs.son[0].getSmallShopById(2); //第一次登陆成功后去调取微店的信息 let isAttestation = 0;
} if (basedata && basedata.user_info && basedata.user_info.isAttestation) {
this.getPageType(); //获取用户类型(校园) isAttestation = basedata.user_info.isAttestation;
let IsOpenMiAi = uni.getStorageSync("basedata") }
? uni.getStorageSync("basedata").mall.setting.is_show_miai let IsOpenGuide = 0;
: 0; //是否开启相亲模式 5-13新加 if (basedata && basedata.mall && basedata.mall.setting && basedata.mall.setting.IsOpenGuide) {
if (this.u.IsOpenSchool == 1 || IsOpenMiAi == 1) { let IsOpenGuide = basedata.mall.setting.IsOpenGuide;
this.init(); }
} if (isAttestation === 0 && IsOpenGuide === 1) {
// 如果登录的情况下直接跳转商品详情或者直播列表 uni.navigateTo({
this.sharejump(); url: "/pages/user-center/user-center",
}, });
getPageType() { }
this.request2( }
{ },
url: "/api/AppletUser/GetAppletUserPageType", yj() {
data: {}, uni.navigateTo({
}, url: "/pages/coffee/index",
(res) => { });
let mall_UserInfo = uni.getStorageSync("mall_UserInfo") },
? uni.getStorageSync("mall_UserInfo") },
: {}; };
mall_UserInfo.IsOpenSchool = res.data.IsOpenSchool;
mall_UserInfo.UserPageType = res.data.UserPageType;
uni.setStorageSync("mall_UserInfo", mall_UserInfo);
if (this.IsOpenSchool == 1 && res.data.UserPageType != 2) {
//这种情况是自己注册过 但是 通过分享进来的判断
this.IsOpenSchool = 0;
this.init();
}
}
);
},
//关闭登录窗口
gbAuth() {
this.showAuth = false;
},
goguidecar() {
uni.navigateTo({
url:
"/pages/guidecar/guidecarGoodsdetails?GoodsId=" +
this.guidecar.GoodsId +
"&address=" +
this.guidecar.address +
"&Pickcar=" +
this.guidecar.Pickcar +
"&StartTime=" +
this.guidecar.StartTime +
"&EndTime=" +
this.guidecar.EndTime,
});
},
getPickcar(Name) {
//选择取消地址
this.$refs.city[0].getPickcar(Name);
},
refreshPage() {
// this.init();
// this.$forceUpdate();
// console.log("tag", "刷新");
},
//橙霜---未认证跳转到引导页
handleChengShuang() {
let AppletID = this.GetMiniAppId().TenantId;
if (AppletID === 24) {
let basedata = wx.getStorageSync("basedata");
let isAttestation = basedata?.user_info?.isAttestation ?? 0;
let IsOpenGuide = wx.getStorageSync("basedata")?.mall?.setting?.IsOpenGuide??0;
if (isAttestation === 0&&IsOpenGuide===1) {
uni.navigateTo({
url: "/pages/user-center/user-center",
});
}
}
},
yj() {
uni.navigateTo({
// url: "/pages/school/personal/receiptDetails?FinanceId=116651",
url: "/pages/coffee/index",
});
},
},
};
</script> </script>
<style> <style>
.content { .content {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
width: 100%; width: 100%;
overflow-x: hidden; overflow-x: hidden;
/* align-items: center; }
justify-content: center; */
} .content .tips_t {
position: fixed;
right: 6px;
height: 36px;
background: #000000;
display: flex;
flex-direction: row;
align-items: center;
padding: 0 10px;
font-size: 12px;
margin-top: 10px;
z-index: 9999999;
}
.triangle-up {
width: 0;
height: 0;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-bottom: 12px solid black;
position: fixed;
right: 65px;
}
.index-title {
line-height: 45px !important;
font-size: 16px;
text-align: center;
position: fixed;
left: 0;
top: 0;
width: 100%;
color: #fff;
box-sizing: content-box;
z-index: 5;
}
.content .tips_t { .back-arrow {
position: fixed; position: absolute;
left: 5px;
bottom: 12.5px;
}
right: 6px; .Startbtn {
height: 36px; position: absolute;
background: #000000; top: 10px;
display: flex; right: 15px;
flex-direction: row; width: 50px;
align-items: center; height: 20px;
padding: 0 10px; background: rgba(45, 45, 45, 0.5);
font-size: 12px; border-radius: 4px;
margin-top: 10px; display: flex;
z-index: 9999999; align-items: center;
} justify-content: center;
color: #fff;
}
.triangle-up { .MainTopLeft {
width: 0; text-align: left !important;
height: 0; padding-left: 10px;
border-left: 10px solid transparent; }
border-right: 10px solid transparent;
border-bottom: 12px solid black;
position: fixed;
right: 65px;
}
.index-title { .contract_nav {
line-height: 45px !important; position: fixed;
font-size: 16px; bottom: 15%;
text-align: center; right: 10rpx;
position: fixed; height: auto;
left: 0; width: 80px;
top: 0; z-index: 99999999999;
width: 100%; display: flex;
color: #fff; flex-direction: column;
box-sizing: content-box; }
z-index: 5;
}
.back-arrow { .Ma_nav-item {
position: absolute; width: 80px;
left: 5px; height: 80px;
bottom: 12.5px; border-radius: 50px;
} margin-top: 12px;
.Startbtn { border: none;
position: absolute; outline: none;
top: 10px; background: transparent;
right: 15px; padding: 0px;
width: 50px; }
height: 20px;
background: rgba(45, 45, 45, 0.5);
border-radius: 4px;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
}
.MainTopLeft {
text-align: left !important;
padding-left: 10px;
}
/* .logo {
height: 200rpx;
width: 200rpx;
margin-top: 200rpx;
margin-left: auto;
margin-right: auto;
margin-bottom: 50rpx;
}
.text-area { .Ma_nav-item::after {
display: flex; border: none;
justify-content: center; }
}
.title { .contract_nav .Ma_nav-item img {
font-size: 36rpx; width: 80px;
color: #8f8f94; height: 80px;
} */ }
.contract_nav {
position: fixed;
bottom: 15%;
right: 10rpx;
height: auto;
width: 80px;
z-index: 99999999999;
display: flex;
flex-direction: column;
}
.Ma_nav-item {
width: 80px;
height: 80px;
border-radius: 50px;
margin-top: 12px;
border: none;
outline: none;
background: transparent;
padding: 0px;
}
.Ma_nav-item::after{ border: none; }
.contract_nav .Ma_nav-item img {
width: 80px;
height: 80px;
}
</style> </style>
...@@ -2,9 +2,11 @@ export default { ...@@ -2,9 +2,11 @@ export default {
install(Vue, options) { install(Vue, options) {
Vue.prototype.host = "https://wx.weibaoge.cn/web/index.php?_mall_id=1285" Vue.prototype.host = "https://wx.weibaoge.cn/web/index.php?_mall_id=1285"
Vue.prototype.host2 = "http://192.168.10.128:8200" Vue.prototype.host2 = "http://localhost:5000"
// Vue.prototype.host2 = "http://192.168.10.46:8200" // Vue.prototype.host2 = "http://192.168.10.46:8200"
// Vue.prototype.host2 = "https://mallApi.oytour.com" // Vue.prototype.host2 = "https://mallApi.oytour.com"
//进阶思维后台地址
Vue.prototype.host3 = "http://192.168.10.128:8900"
Vue.prototype.UploadConfig = function() { //本地上传配置 Vue.prototype.UploadConfig = function() { //本地上传配置
return { return {
...@@ -60,7 +62,7 @@ export default { ...@@ -60,7 +62,7 @@ export default {
this.getLogin_t(u) this.getLogin_t(u)
} }
} else if (res.data.resultCode != 1) { } else if (res.data.resultCode != 1) {
if (res.data.message) { if (res.data.message) {
uni.showToast({ uni.showToast({
title: res.data.message, title: res.data.message,
...@@ -125,6 +127,45 @@ export default { ...@@ -125,6 +127,45 @@ export default {
}); });
} }
//进阶思维后台接口
Vue.prototype.requestJJSWAdmin = function(cmd, postMsg, success, failed) {
uni.request({
url: this.host3 + cmd,
method: "Post",
header: {
'content-type': "application/json"
},
data: {
msg: postMsg
},
success: res => {
if (res.Code == 10000) {
let u = uni.getStorageSync("mall_UserInfo");
if (u) {
this.getLogin_t(u)
}
} else if (res.Code != 1) {
if (res.Message != '') {
uni.showToast({
title: res.Message,
icon: "none",
});
}
typeof failed == "function" && failed(res.Data);
} else {
typeof success == "function" && success(res.Data);
}
},
fail: (e) => {
console.log("网络请求fail:" + JSON.stringify(e));
uni.showModal({
content: "" + res.Message
});
typeof failed == "function" && failed(res.data);
}
});
}
// token失效再次登录接口 // token失效再次登录接口
Vue.prototype.getLogin_t = function(obj) { Vue.prototype.getLogin_t = function(obj) {
let pid = uni.getStorageSync("pid") ? uni.getStorageSync("pid").pid : 0; let pid = uni.getStorageSync("pid") ? uni.getStorageSync("pid").pid : 0;
...@@ -133,7 +174,7 @@ export default { ...@@ -133,7 +174,7 @@ export default {
let CounponPassword = uni.getStorageSync("CounponPassword") ? uni.getStorageSync("CounponPassword").CounponPassword : let CounponPassword = uni.getStorageSync("CounponPassword") ? uni.getStorageSync("CounponPassword").CounponPassword :
0; 0;
let KeyWord = uni.getStorageSync("KeyWord") ? uni.getStorageSync("KeyWord").KeyWord : ''; let KeyWord = uni.getStorageSync("KeyWord") ? uni.getStorageSync("KeyWord").KeyWord : '';
let EduId = uni.getStorageSync("jxhData") ? uni.getStorageSync("jxhData").Id : 0; let EduId = uni.getStorageSync("jxhData") ? uni.getStorageSync("jxhData").Id : 0;
this.request2({ this.request2({
url: '/api/AppletLogin/Login', url: '/api/AppletLogin/Login',
data: { data: {
...@@ -147,7 +188,7 @@ export default { ...@@ -147,7 +188,7 @@ export default {
UserPageType: Up, UserPageType: Up,
CounponPassword: CounponPassword, CounponPassword: CounponPassword,
KeyWord: KeyWord, KeyWord: KeyWord,
EduId:EduId, EduId: EduId,
} }
}, },
res => { res => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment