| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533 |
- <template>
- <view>
- <view :class="'mine' + (skinNotColor ? ' not-color' : '')">
- <image src="/static/images/wdbg.png" class="wdbg"
- @click="jumpUrl('mine/userinfo/userinfo')"></image>
- <view class="minec">
- <image :src="userInfos.avatar ? userInfos.avatar : '/static/pages/images/userimg.png'" mode="aspectFit"
- class="user" @click="jumpUrl('mine/userinfo/userinfo')"></image>
- <view class="mines" @click="jumpUrl('mine/userinfo/userinfo')" v-if="isLogin">
- <view class="ddflex">{{userInfos.nickName}}
- <image :src="config.ordinary_member_icon" class="common-vip"
- v-if="config.ordinary_member_icon&&!userinfovip.levelGrade"></image>
- </view>
- <text class="edu" v-if="userInfos.mobile">{{userInfos.mobile}}</text>
- </view>
- <view class="flex" v-else>
- <text class="login-btn" @click="jumpUrl('')">点击登录</text>
- </view>
-
- </view>
- </view>
- <view class="yichang-box ddflex">
- <view class="yichang-item fflex" @click="jumpUrl('warning/abnormalAlarm/abnormalAlarm')">
- <view class="yichang-title">异常告警</view>
- <view class="yichang-data">10<text class="symbol">条</text></view>
- <view class="yichang-btn">去查看</view>
- <image src="../../static/images/ycjg.png"></image>
- </view>
- <view class="yichang-item fflex" style="margin-left: 26rpx;" @click="jumpUrl('warning/orderAlarm/orderAlarm')">
- <view class="yichang-title">异常处理</view>
- <view class="yichang-data">10<text class="symbol">个</text></view>
- <view class="yichang-btn">去处理</view>
- <image src="../../static/images/yccl.png"></image>
- </view>
- </view>
-
- <view class="order">
- <view class="tits dflex">
- <view class="flex">我的服务</view>
- </view>
- <view class="list2 dflex">
- <navigator url="" hover-class="none" class="li" @click="jumpUrl('mine/order/order')">
- <image src="../../static/pages/images/user_service1.png"></image>
- <text>我的订单</text>
- </navigator>
- <navigator url="" hover-class="none" class="li" @click="jumpUrl('pages/myMerchant/myMerchant')">
- <image src="../../static/pages/images/user_service2.png"></image>
- <text>我的商家</text>
- </navigator>
- <navigator url="" hover-class="none" class="li" @click="jumpUrl('integralshop/index/index')">
- <image src="../../static/pages/images/user_service3.png"></image>
- <text>我的门店</text>
- </navigator>
- <navigator url="" hover-class="none" class="li" @click="jumpUrl('pages/operationData/operationData')">
- <image src="../../static/pages/images/user_service4.png"></image>
- <text>运营数据</text>
- </navigator>
- <view class="li">
- <contact-button img-url="../../static/pages/images/user_service5.png" img-style='width: 74rpx;height: 74rpx;margin: 0 auto 12rpx;' button-text="官方客服" styles="line-height:initial;"></contact-button>
- </view>
- <navigator url="/pages/about/about" hover-class="none" class="li">
- <image src="../../static/pages/images/user_service6.png"></image>
- <text>关于我们</text>
- </navigator>
- <navigator url="/mine/feedback/feedback" hover-class="none" class="li">
- <image src="../../static/pages/images/user_service7.png"></image>
- <text>建议反馈</text>
- </navigator>
- <navigator url="/mine/feedback/feedback" hover-class="none" class="li">
- <image src="../../static/pages/images/user_service8.png"></image>
- <text>退出登录</text>
- </navigator>
- </view>
- </view>
- <!-- 注册成为会员 -->
- <view class="mask" :hidden="isHide" @tap="hideRegister"></view>
- <view class="regi" :hidden="isHide">
- <view class="regi-tit">注册会员<image src="/static/pages/images/close1.png" class="regi-close"
- @tap="hideRegister"></image>
- </view>
- <view class="phone dflex">
- <input placeholder="手机号" placeholder-class="placeholder" class="flex"></input>
- <button open-type="getPhoneNumber" @getphonenumber="getphonenumber" class="getphone dflex">
- <image src="/static/pages/images/wxico.png"></image>一键获取
- </button>
- </view>
- <view class="regi-btn">立即注册</view>
- </view>
- <footer-copyright></footer-copyright>
- <!-- <view class="placeholder-view" :style="'height:' + (bottomBlankHeignt + 115) + 'rpx'"></view> -->
- <foot channel="user" :isUpdate="isUpdate"></foot>
- <update-userinfo :update-info="isUpdateInfo" :update-mobile="isUpdateMobile" v-if="isShowUpdate" @closeUpdate="closeUpdate" @updateInfo="updateInfo" @updateMobile="updateMobile"></update-userinfo>
- <!-- <web-view src="https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx86937a61b8d50977&redirect_uri=https%3a%2f%2fwebtest.tongyu99.com&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"></web-view> -->
- </view>
- </template>
- <script>
- // pages/user/user.js
- const app = getApp();
- const req = require("../../utils/request.js");
- const route = require("../../utils/route");
- import foot from "../../components/nav-bar/index";
- import footerCopyright from "../../components/footer-copyright/footer-copyright";
- export default {
- data() {
- return {
- skinNotColor: req.public.skinNotColor,
- picUrlss: req.public.picUrls,
- bottomBlankHeignt: app.globalData.isIPhoneX ? 68 : 0,
- // merchantId: '',
- iconSrc: req.public.iconSrc,
- //头部页面背景链接
- isUpdate: false,
- // 是否更新消息
- isHideVip: true,
- //隐藏会员
- isVip: true,
- //是否是会员
- isHide: true,
- //是否隐藏注册会员弹窗
- IS_secondary_members: 0,
- distr: "",
- userinfovip: "",
- userMoney: "",
- istetphone: "",
- logo: "",
- name: "",
- is_open_wallet: "",
- Open_Points_Mall: "",
- statistics: "",
- vipList: "",
- rongkang: req.header.appId,
- isSign: '',
- sign: 0,
- isLogin: false,
- noLogin: false,
- is_open_shop: '',
- isShowSign: false, //是否显示签到按钮
- config: {},
- userInfos: {},
- newsCount: 0,
- isShowUpdate: false,//是否显示更新信息弹窗
- isUpdateInfo: false,//更新用户信息
- isUpdateMobile: false,//绑定手机号
- };
- },
- components: {
- foot,
- footerCopyright
- },
- props: {},
- onLoad(options) {
- app.globalData.getCheckSessoin(json => {
- this.sessionKey = json.session_key;
- });
- uni.setNavigationBarColor({
- frontColor: this.skinNotColor ? '#000' : '#ffffff',
- backgroundColor: this.skinNotColor ? '#fff' : req.public.titleTopBgColor
- });
- if (JSON.parse(req.getStorage('configRes')).IS_secondary_members) {
- let IS_secondary_members = JSON.parse(req.getStorage('configRes')).IS_secondary_members;
- console.log(IS_secondary_members)
- this.setData({
- IS_secondary_members: IS_secondary_members
- });
- }
- let userInfo = req.getStorage('userInfo');
- if(req.isAuth()){
- setTimeout(res=>{
- if(!userInfo.avatar || userInfo.nickName == '微信用户' || this.userInfos.nickName == '微信用户'){
- this.isShowUpdate = true
- this.isUpdateInfo = true
- }
- if(userInfo.avatar&&!userInfo.mobile&&(this.userInfos&&!this.userInfos.mobile)){
- this.isShowUpdate = true
- this.isUpdateMobile = true
- }
- },2000)
- }
- },
- onShow: function() {
- this.setData({
- isUpdate: !this.isUpdate
- }); // let merchantId = req.getStorage('userInfo').merchantId
- // this.setData({
- // merchantId: merchantId,
- // })
- // console.log(this.merchantId);
- // this.getMy();
- // this.getAbout();
- // console.log(this.noLogin, 111111111111)
- let userInfo = req.getStorage('userInfo');
- // if (userInfo) this.isLogin = true;
- this.isLogin = req.isAuth();
- if (this.isLogin) {
- this.getMy();
- this.getNewsCount();
- this.getAbout();
- this.getRule();
- this.noLogin = true;
- } else {
- this.noLogin = false;
- }
- },
- methods: {
- jumpUrl(url) {
- if (!req.isLogin()) return false;
- app.globalData.navigateTo(url);
- },
- jumpMerchantManage() {
- // jumpUrl('pages/web/web')
- let token = req.getStorage('AUTH_TOKEN');
- this.jumpUrl('merchant/index?appId=' + req.header.appId + '&token=' + token);
- },
- // 是否签到{}
- isSignFun() {
- req.getRequest('/api/integral/isSign', {}, res => {
- this.setData({
- isSign: res
- });
- });
- },
- gouserInfo() {
- app.globalData.navigateTo('mine/userinfo/userinfo')
- },
- getDistributionConfig() {
- req.postRequest('/api/distribution/config', {}, res => {
- this.setData({
- distr: res
- });
- });
- },
- // 签到
- signFun() {
- req.postRequest('/api/integral/sign', {}, data => {
- if (data) {
- req.msg('连续签到' + data.continuityDay + '天' + ',获得' + data.IntegralChange + '积分');
- this.setData({
- sign: 1
- });
- this.getOpenPonints();
- }
- });
- },
- getuserVip() {
- req.getRequest('/api/user/levelDetails', {}, data => {
- let expireTime = Array;
- if (data.expireTime) {
- expireTime = data.expireTime.split(" ");
- data.expireTime = data.expireTime.replace(/-/g, '/');
- } // 解决苹果不兼容---日期
- // data.expireTime=data.expireTime.replace(/-/g, '/')
- let nowTime = new Date().getTime();
- let endTime = new Date(data.expireTime).getTime();
- let times = parseInt((endTime - nowTime) / 1000); // var expireTime= new Date(data.expireTime)
- // var time1=expireTime.getTime();
- // console.log(times, nowTime, endTime, data.expireTime);
- this.setData({
- userinfovip: data,
- ['userinfovip.expireTime']: expireTime[0]
- });
- if (times <= 0) {
- this.setData({
- ['userinfovip.end']: true
- });
- } else {
- this.setData({
- ['userinfovip.end']: false
- });
- }
- // console.log(data);
- });
- },
- getOpenPonints() {
- req.getRequest('/api/integral/returnIntegral', {}, res => {
- this.setData({
- integral: res
- })
- })
- },
- getMy() {
- let that = this;
- req.getRequest('/api/user/my', {}, data => {
- // data.merchantId = req.getStorage('userInfo').merchantId
- data.nickName = req.excludeSpecial(data.nickName);
- this.userInfos = data;
- let userInfo = req.getStorage('userInfo');
- userInfo.isDistriUser = this.userInfos.isDistriUser;
- req.setStorage('userInfo', userInfo);
- // that.setData(data); // this.isbindmobile();
- console.log('userinfo==' + JSON.stringify(data))
- this.isSignFun();
- this.getstatistics(data);
- this.getDistributionConfig();
- this.getuserVip();
- this.getuserMoney();
- this.getVip();
- this.getOpenPonints();
- // console.log(this);
- });
- },
- getuserMoney() {
- let is_open_wallet = JSON.parse(req.getStorage('configRes')).is_open_wallet;
- if (is_open_wallet) {
- if (JSON.parse(is_open_wallet).isOpenWallet == 1) {
- route.extendNew({}, res => {
- // console.log(parseFloat(res.all).toFixed(2));
- if (res) this.setData({
- userMoney: parseFloat(res.all).toFixed(2)
- });
- });
- }
- }
- },
- getNewsCount(){
- req.getRequest('/api/v3/fabulous/countComment',{},res=>{
- this.newsCount = res;
- })
- },
- getAbout() {
- var _this = this;
- req.getRequest('/api/config', {}, function(res) {
- _this.phone = res.CONFIG_SERVICE_HOT_MOBILE;
- _this.config = res;
- _this.setData({
- istetphone: res.user_bind_mobile,
- logo: res.CONFIG_PROJECT_LOGO,
- name: res.CONFIG_PROJECT_TITLE
- });
- // console.log(res);
- if (res && res.is_open_wallet) {
- _this.setData({
- is_open_wallet: JSON.parse(res.is_open_wallet)
- });
- }
- if (res.is_open_shop) {
- _this.is_open_shop = res.is_open_shop;
- }
- // if (res.user_bind_mobile == '1') {
- // let userInfo = req.getStorage('userInfo');
- // if (userInfo && (userInfo.mobile == null || userInfo.mobile == '')) {
- // app.globalData.openPage('pages/authorize/authorize?bindmobile=1');
- // }
- // }
- });
- // 是否开启积分商城
- req.getRequest('/api/params/value', {
- type: 'Open_Points_Mall'
- }, res => {
- this.setData({
- Open_Points_Mall: res
- });
- });
- },
- getphonenumber(event) {
- const detail = event.detail;
- const _ts = this;
- if (!detail || !detail.encryptedData || !detail.iv) return false;
- req.postRequest('/api/weixin/mobile', {
- encryptedData: detail.encryptedData,
- iv: detail.iv,
- sessionKey: this.sessionKey
- }, res => {
- _ts.getMy();
- });
- },
- callPhone() {
- if (!req.isLogin()) return false;
- uni.makePhoneCall({
- phoneNumber: this.phone
- });
- },
- showRegister() {
- //显示注册会员弹窗
- this.setData({
- isHide: false
- });
- },
- hideRegister() {
- //隐藏注册会员弹窗
- this.setData({
- isHide: true
- });
- },
- goUrl() {
- app.globalData.openPage('mine/vip/vip');
- },
- // 门店统计
- getstatistics(data) {
- let from = {};
- if (data.listShopBase && data.listShopBase != null && data.listShopBase.length > 0) {
- from.shopId = data.listShopBase[0].id;
- }
- if (data.listMerchant && data.listMerchant != null && data.listMerchant.length > 0 && data.listShopBase
- .length < 1) {
- from.merchantId = data.listMerchant[0].id;
- }
- req.getRequest('/api/order/statistics', from, data => {
- this.setData({
- statistics: data
- });
- console.log(data);
- });
- },
- getRule() {
- let that = this;
- req.getRequest('/api/integral/config', {}, res => {
- if (res && res.length > 0) {
- res.map(it => {
- if (it.illustrate && it.illustrate.indexOf('签到') > -1) {
- if (it.state == 2) {
- that.isShowSign = true;
- }
- }
- })
- }
- })
- },
- getVipListOrg() {
- if (this.vipList && this.userinfovip) {
- if(!this.userinfovip.levelGrade){
- this.vipList.map((it,index)=>{
- this.vipList[0].isShowInfo = true;
- })
- }else{
- this.vipList.map((it,index)=>{
- if(this.userinfovip.level == it.id){
- if(index < this.vipList.length-1){
- this.vipList[index+1].isShowInfo = true;
- }
- }
- })
- }
- }
- },
- getVip() {
- req.getRequest('/api/levelStrategy/userLevelList', {}, data => {
- if (data && data.length > 0) {
- data.map((it,index) => {
- it.upgradeTerm = JSON.parse(it.upgradeTerm)
- it.isShowInfo = false
- // if(index == 0) it.isShowInfo = true;
- return it;
- })
- this.vipList = data
- this.getVipListOrg();
- }
- });
- },
- showInfo(index) {
- if(!this.vipList[index].isShowInfo){
- this.vipList.map(it=>{
- it.isShowInfo = false;
- return it
- })
- }
- this.vipList[index].isShowInfo = !this.vipList[index].isShowInfo
- },
- closeUpdate(){
- this.isShowUpdate = false
- },
- updateInfo(e){
- this.isUpdateInfo = e
- this.getMy()
- },
- updateMobile(e){
- this.isUpdateMobile = e
- this.getMy()
- },
- // 判断强制绑定手机号
- // isbindmobile() {
- // if (req.getStorage('configRes')) {
- // let configRes = JSON.parse(req.getStorage('configRes'))
- // this.setData({ istetphone: configRes.user_bind_mobile, logo: configRes.CONFIG_PROJECT_LOGO, name: configRes.CONFIG_PROJECT_TITLE })
- // } else {
- // req.g('/api/config', (res) => {
- // req.setStorage('configRes', JSON.stringify(res))
- // this.setData({ istetphone: res.user_bind_mobile, logo: res.CONFIG_PROJECT_LOGO, name: res.CONFIG_PROJECT_TITLE })
- // })
- // }
- // if(this.data.istetphone=='1'){
- // // 获取用户手机号
- // let userInfo= req.getStorage('userInfo')
- // if(userInfo.mobile==null||userInfo.mobile==''){
- // console.log("获取用户手机号===============================")
- // app.openPage('pages/authorize/authorize?bindmobile=1')
- // }
- // }
- // },
- }
- };
- </script>
- <style>
- @import "./user.css";
- </style>
|