【模版目录】更新用户端页面源码

This commit is contained in:
吴昊天 2022-10-28 17:59:25 +08:00
parent 61a14862d1
commit 4dbe755fa5
41 changed files with 5901 additions and 5819 deletions

View File

@ -81,6 +81,44 @@
}
}
},
onShow() {
const queryData = uni.getEnterOptionsSync() // uni-app版本 3.5.1+ 支持
if (queryData.query.spread) {
this.$Cache.set('spread', queryData.query.spread);
this.globalData.spid = queryData.query.spread;
this.globalData.pid = queryData.query.spread;
silenceBindingSpread(this.globalData)
}
if (queryData.query.spid) {
this.$Cache.set('spread', queryData.query.spid);
this.globalData.spid = queryData.query.spid;
this.globalData.pid = queryData.query.spid;
silenceBindingSpread(this.globalData)
}
// #ifdef MP
if (queryData.query.scene) {
switch (queryData.scene) {
//扫描小程序码
case 1047:
this.globalData.code = queryData.query.scene;
break;
//长按图片识别小程序码
case 1048:
this.globalData.code = queryData.query.scene;
break;
//手机相册选取小程序码
case 1049:
this.globalData.code = queryData.query.scene;
break;
//直接进入小程序
case 1001:
this.globalData.spid = queryData.query.scene;
break;
}
silenceBindingSpread(this.globalData)
}
// #endif
},
async onLaunch(option) {
let that = this;
colorChange('color_change').then(res => {
@ -113,25 +151,14 @@
break
}
});
console.log(Cache.has('localeJson', true))
if (!Cache.has('localeJson', true)) {
if (!Cache.has('localeSet')) {
getLangJson().then(res => {
Cache.set('localeJson', res.data, 600);
// uni.setStorageSync('localeJson', res.data)
Cache.set('locale', Object.keys(res.data)[0])
uni.setStorageSync('localeJson', res.data);
Cache.set('localeSet', true, 600) // 语言类型缓存时间
})
}
if (option.query.spread) {
that.$Cache.set('spread', option.query.spread);
that.globalData.spid = option.query.spread;
that.globalData.pid = option.query.spread;
silenceBindingSpread()
}
if (option.query.spid) {
that.$Cache.set('spread', option.query.spid);
that.globalData.spid = option.query.spid;
that.globalData.pid = option.query.spid;
// silenceBindingSpread()
}
// #ifdef APP-PLUS || H5
uni.getSystemInfo({
success: function(res) {
@ -155,53 +182,43 @@
);
return false;
}
if (option.query.hasOwnProperty('scene')) {
switch (option.scene) {
//扫描小程序码
case 1047:
let val = that.$util.getUrlParams(decodeURIComponent(option.query.scene));
that.globalData.code = val.pid === undefined ? val : val.pid;
break;
//长按图片识别小程序码
case 1048:
that.globalData.code = option.query.scene;
break;
//手机相册选取小程序码
case 1049:
that.globalData.code = option.query.scene;
break;
//直接进入小程序
case 1001:
that.globalData.spid = option.query.scene;
break;
}
}
const updateManager = wx.getUpdateManager();
updateManager.onCheckForUpdate(function(res) {
// 请求完新版本信息的回调
});
updateManager.onUpdateReady(function() {
wx.showModal({
title: '更新提示',
content: '新版本已经准备好,是否重启应用?',
success: function(res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate();
}
const startParamObj = wx.getEnterOptionsSync();
if (wx.canIUse('getUpdateManager') && startParamObj.scene != 1154) {
const updateManager = wx.getUpdateManager()
console.log(updateManager);
updateManager.onCheckForUpdate(function(res) {
// 请求完新版本信息的回调
// console.log(res.hasUpdate)
if (res.hasUpdate) {
updateManager.onUpdateFailed(function() {
return that.Tips({
title: '新版本下载失败'
});
});
updateManager.onUpdateReady(function() {
wx.showModal({
title: '更新提示',
content: '新版本已经下载好,是否重启当前应用?',
success(res) {
if (res.confirm) {
updateManager.applyUpdate()
}
}
})
})
updateManager.onUpdateFailed(function() {
wx.showModal({
title: '发现新版本',
content: '请删除当前小程序,重启搜索打开...',
})
})
}
});
});
updateManager.onUpdateFailed(function() {
return that.Tips({
title: '新版本下载失败'
});
});
})
}
// #endif
// getShopConfig().then(res => {
// this.$store.commit('SETPHONESTATUS', res.data.status);
// });
@ -215,7 +232,7 @@
let menuButtonInfo = uni.getMenuButtonBoundingClientRect();
that.globalData.navH = menuButtonInfo.top * 2 + menuButtonInfo.height / 2;
const version = uni.getSystemInfoSync().SDKVersion
if (Routine.compareVersion(version, '2.21.2') >= 0) {
if (Routine.compareVersion(version, '2.21.3') >= 0) {
console.log(version)
that.$Cache.set('MP_VERSION_ISNEW', true)
} else {

View File

@ -9,7 +9,7 @@ module.exports = {
// #ifdef H5
//H5接口是浏览器地址,非单独部署不用修改
HTTP_REQUEST_URL: window.location.protocol + "//" + window.location.host,
// #endif
// #endif
// 以下配置在不做二开的前提下,不需要做任何的修改
HEADER: {

View File

@ -153,7 +153,6 @@ class Routine {
uni.login({
provider: provider,
success(res) {
console.log(res, '22222')
if (res.code) Cache.set(STATE_R_KEY, res.code, 10800);
return resolve(res.code);
},

View File

@ -48,9 +48,9 @@ class AuthWechat {
}
signLink() {
if (typeof window.entryUrl === 'undefined' || window.entryUrl === '') {
window.entryUrl = document.location.href
}
// if (typeof window.entryUrl === 'undefined' || window.entryUrl === '') {
// window.entryUrl = encodeURI(window.location.href)
// }
return /(Android)/i.test(navigator.userAgent) ? document.location.href : window.entryUrl;
}

View File

@ -1,87 +1,95 @@
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
import Vue from 'vue'
import App from './App'
import store from './store'
import Cache from './utils/cache'
import util from 'utils/util'
import configs from './config/app.js'
import socket from './libs/new_chat.js'
import i18n from './utils/lang.js';
Vue.prototype.$util = util;
Vue.prototype.$config = configs;
Vue.prototype.$Cache = Cache;
Vue.prototype.$eventHub = new Vue();
Vue.prototype.$socket = new socket();
Vue.config.productionTip = false
import pageLoading from './components/pageLoading.vue'
import skeleton from './components/skeleton/index.vue'
Vue.component('skeleton', skeleton)
Vue.component('pageLoading',pageLoading)
// #ifdef H5
import { parseQuery } from "./utils";
import Auth from './libs/wechat';
import { SPREAD } from './config/cache';
Vue.prototype.$wechat = Auth;
let cookieName = "VCONSOLE",
query = parseQuery(),
urlSpread = query["spread"],
vconsole = query[cookieName.toLowerCase()],
md5Crmeb = "b14d1e9baeced9bb7525ab19ee35f2d2", //CRMEB MD5 加密开启vconsole模式
md5UnCrmeb = "3dca2162c4e101b7656793a1af20295c"; //UN_CREMB MD5 加密关闭vconsole模式
if (urlSpread !== undefined) {
var spread = Cache.get(SPREAD);
urlSpread = parseInt(urlSpread);
if (!Number.isNaN(urlSpread) && spread !== urlSpread) {
Cache.set("spread", urlSpread || 0);
} else if (spread === 0 || typeof spread !== "number") {
Cache.set("spread", urlSpread || 0);
}
}
if (vconsole !== undefined) {
if (vconsole === md5UnCrmeb && Cache.has(cookieName))
Cache.clear(cookieName);
} else vconsole = Cache.get(cookieName);
import VConsole from './pages/extension/components/vconsole.min.js'
if (vconsole !== undefined && vconsole === md5Crmeb) {
Cache.set(cookieName, md5Crmeb, 3600);
let vConsole = new VConsole();
}
// let snsapiBase = 'snsapi_base';
// Auth.isWeixin() && Auth.oAuth(snsapiBase);
//全局路由前置守卫
// #endif
App.mpType = 'app'
const app = new Vue({
...App,
store,
Cache,
i18n,
})
app.$mount();
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
import Vue from 'vue'
import App from './App'
import store from './store'
import Cache from './utils/cache'
import util from 'utils/util'
import configs from './config/app.js'
import socket from './libs/new_chat.js'
import i18n from './utils/lang.js';
Vue.prototype.$util = util;
Vue.prototype.$config = configs;
Vue.prototype.$Cache = Cache;
Vue.prototype.$eventHub = new Vue();
Vue.prototype.$socket = new socket();
Vue.config.productionTip = false
import pageLoading from './components/pageLoading.vue'
import skeleton from './components/skeleton/index.vue'
Vue.component('skeleton', skeleton)
Vue.component('pageLoading', pageLoading)
// #ifdef H5
import {
parseQuery
} from "./utils";
import Auth from './libs/wechat';
import {
SPREAD
} from './config/cache';
Vue.prototype.$wechat = Auth;
let cookieName = "VCONSOLE",
query = parseQuery(),
urlSpread = query["spread"],
vconsole = query[cookieName.toLowerCase()],
md5Crmeb = "b14d1e9baeced9bb7525ab19ee35f2d2", //CRMEB MD5 加密开启vconsole模式
md5UnCrmeb = "3dca2162c4e101b7656793a1af20295c"; //UN_CREMB MD5 加密关闭vconsole模式
if (urlSpread !== undefined) {
var spread = Cache.get(SPREAD);
urlSpread = parseInt(urlSpread);
if (!Number.isNaN(urlSpread) && spread !== urlSpread) {
Cache.set("spread", urlSpread || 0);
} else if (spread === 0 || typeof spread !== "number") {
Cache.set("spread", urlSpread || 0);
}
}
if (vconsole !== undefined) {
if (vconsole === md5UnCrmeb && Cache.has(cookieName))
Cache.clear(cookieName);
} else vconsole = Cache.get(cookieName);
import VConsole from './pages/extension/components/vconsole.min.js'
if (vconsole !== undefined && vconsole === md5Crmeb) {
Cache.set(cookieName, md5Crmeb, 3600);
let vConsole = new VConsole();
}
// let snsapiBase = 'snsapi_base';
// Auth.isWeixin() && Auth.oAuth(snsapiBase);
// 记录进入app时的url
if (typeof window.entryUrl === 'undefined' || window.entryUrl === '') {
window.entryUrl = location.href
}
//全局路由前置守卫
// #endif
App.mpType = 'app'
const app = new Vue({
...App,
store,
Cache,
i18n,
})
app.$mount();

View File

@ -167,7 +167,7 @@
"quickapp" : {},
/* 小程序特有相关 */
"mp-weixin" : {
"appid" : "wx3b82801238ca1b57",
"appid" : "wx1234567890",
"setting" : {
"urlCheck" : false,
"minified" : true,
@ -179,7 +179,13 @@
"desc" : "你的位置信息将用于和门店的距离长度"
}
},
"usingComponents" : true
"usingComponents" : true,
"requiredPrivateInfos" : [
"getLocation",
"onLocationChange",
"startLocationUpdateBackground",
"chooseAddress"
]
},
"mp-alipay" : {
"usingComponents" : true

View File

@ -944,7 +944,7 @@
],
"plugins": {
"live-player-plugin": {
"version": "1.3.2",
"version": "1.3.5",
"provider": "wx2b03c6e691cd7370"
}
}

View File

@ -271,9 +271,6 @@
import countDown from '@/components/countDown';
import home from '@/components/home';
import parser from '@/components/jyf-parser/jyf-parser';
import {
silenceBindingSpread
} from '@/utils';
// #ifdef APP-PLUS
import {
TOKENNAME,
@ -479,8 +476,6 @@
`/pages/activity/goods_bargain_details/index?id=${options.id}&bargain=${this.bargainUid}`);
toLogin();
}
this.isLogin && silenceBindingSpread();
uni.setNavigationBarTitle({
title: this.$t(`砍价详情`)
});

View File

@ -47,7 +47,7 @@
<view class='nav acea-row row-between-wrapper'>
<view class='money'>{{$t(`¥`)}}<text class='num'>{{storeInfo.price}}</text>
<text
v-if="attribute.productAttr.length && (attribute.productAttr.length?attribute.productAttr[0].attr_values.length:0) > 1">{{$t(`onwards`)}}</text>
v-if="attribute.productAttr.length && (attribute.productAttr.length?attribute.productAttr[0].attr_values.length:0) > 1">{{$t(`起`)}}</text>
<text class='y-money'>{{$t(`¥`)}}{{storeInfo.ot_price}}</text>
</view>
<view class='acea-row row-middle'>
@ -256,9 +256,6 @@
import {
toLogin
} from '@/libs/login.js';
import {
silenceBindingSpread
} from "@/utils";
import {
getUserInfo
} from '@/api/user.js';
@ -403,7 +400,6 @@
//res.windowHeight:获取整个窗口高度为px,*2为rpx;98为头部占据的高度;
},
});
this.isLogin && silenceBindingSpread();
// #ifdef MP
this.navH = app.globalData.navHeight;
// #endif

View File

@ -265,9 +265,6 @@
import userEvaluation from '@/components/userEvaluation';
import shareRedPackets from '@/components/shareRedPackets';
import kefuIcon from '@/components/kefuIcon';
import {
silenceBindingSpread
} from '@/utils';
import parser from '@/components/jyf-parser/jyf-parser';
import ClipboardJS from '@/plugin/clipboard/clipboard.js';
// #ifdef MP
@ -444,10 +441,6 @@
if (options.spid) app.globalData.spid = options.spid;
// #endif
that.getGoodsDetails();
// that.getCouponList(0);
//#ifdef H5
that.isLogin && silenceBindingSpread();
//#endif
},
onReady: function() {
this.$nextTick(function() {

View File

@ -4,21 +4,21 @@
<view v-if="insert || show" class="uni-calendar__content" :class="{'uni-calendar--fixed':!insert,'uni-calendar--ani-show':aniMaskShow}">
<view v-if="!insert" class="uni-calendar__header uni-calendar--fixed-top">
<view class="uni-calendar__header-btn-box" @click="close">
<text class="uni-calendar__header-text uni-calendar--fixed-width">{{$t(`cansel`)}}</text>
<text class="uni-calendar__header-text uni-calendar--fixed-width">{{$t(`取消`)}}</text>
</view>
<view class="uni-calendar__header-btn-box" @click="confirm">
<text class="uni-calendar__header-text uni-calendar--fixed-width">{{$t(`confirm`)}}</text>
<text class="uni-calendar__header-text uni-calendar--fixed-width">{{$t(`确定`)}}</text>
</view>
</view>
<view class="uni-calendar__header">
<view class="uni-calendar__header-btn-box" @click="pre">
<view class="uni-calendar__header-btn uni-calendar--left"></view>
</view>
<text class="uni-calendar__header-text">{{ (nowDate.year||'') +$t(`year`)+( nowDate.month||'') +$t(`month`)}}</text>
<text class="uni-calendar__header-text">{{ (nowDate.year||'') +$t(`年`)+( nowDate.month||'') +$t(`月`)}}</text>
<view class="uni-calendar__header-btn-box" @click="next">
<view class="uni-calendar__header-btn uni-calendar--right"></view>
</view>
<text class="uni-calendar__backtoday" @click="backtoday">{{$t(`back_today`)}}</text>
<text class="uni-calendar__backtoday" @click="backtoday">{{$t(`回到当天`)}}</text>
</view>
<view class="uni-calendar__box">
<view v-if="showMonth" class="uni-calendar__box-bg">
@ -26,25 +26,25 @@
</view>
<view class="uni-calendar__weeks">
<view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text">{{$t(`sun`)}}</text>
<text class="uni-calendar__weeks-day-text">{{$t(`天`)}}</text>
</view>
<view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text">{{$t(`mon`)}}</text>
<text class="uni-calendar__weeks-day-text">{{$t(`一`)}}</text>
</view>
<view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text">{{$t(`tue`)}}</text>
<text class="uni-calendar__weeks-day-text">{{$t(`二`)}}</text>
</view>
<view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text">{{$t(`wed`)}}</text>
<text class="uni-calendar__weeks-day-text">{{$t(`三`)}}</text>
</view>
<view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text">{{$t(`thu`)}}</text>
<text class="uni-calendar__weeks-day-text">{{$t(`四`)}}</text>
</view>
<view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text">{{$t(`fri`)}}</text>
<text class="uni-calendar__weeks-day-text">{{$t(`五`)}}</text>
</view>
<view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text">{{$t(`sat`)}}</text>
<text class="uni-calendar__weeks-day-text">{{$t(`六`)}}</text>
</view>
</view>
<view class="uni-calendar__weeks" v-for="(item,weekIndex) in weeks" :key="weekIndex">

View File

@ -714,9 +714,8 @@
color: #333;
border-radius: 3rpx;
border: 1px solid #666;
padding: 0rpx 15rpx;
padding: 2rpx 15rpx;
margin-left: 24rpx;
height: 40rpx;
}
.order-details .wrapper .actualPay {
@ -866,7 +865,6 @@
border: 1px solid #666;
padding: 0px 7px;
margin-left: 12px;
height: 20px;
}
.upload .pictrue {

View File

@ -370,12 +370,16 @@
</script>
<style lang="scss" scoped>
.pos-order-list {
.pos-order-list {
padding-top: 96rpx;
.search {
padding-left: 30rpx;
padding-top: 30rpx;
background-color: #fff;
position: fixed;
top: 0;
left: 0;
z-index: 999;
.input {
width: 598rpx;
background-color: #f7f7f7;

View File

@ -185,6 +185,7 @@
captchaType: 'blockPuzzle',
captchaVerification: data.captchaVerification
}).then(res => {
this.sendCode()
that.$util.Tips({
title: res.msg
});

View File

@ -808,7 +808,8 @@
that.$set(that, 'special_invoice', res.data.special_invoice);
that.$set(that, 'store_self_mention', res.data.store_self_mention);
that.$set(that, 'virtual_type', res.data.virtual_type || 0);
that.$set(that, 'integral_open', res.data.integral_open);
that.$set(that, 'integral_open', res.data.integral_open);
uni.hideLoading()
//微信支付是否开启
that.cartArr[0].payStatus = res.data.pay_weixin_open || 0
//支付宝是否开启
@ -834,7 +835,6 @@
if (this.addressId) {
this.computedPrice();
}
uni.hideLoading()
}).catch(err => {
uni.hideLoading()
return this.$util.Tips({
@ -871,11 +871,13 @@
* 获取当前金额可用优惠券
*
*/
getCouponList: function() {
getCouponList: function() {
let shippingType = this.shippingType;
let that = this;
let data = {
cartId: this.cartId,
'new': this.news
'new': this.news,
'shippingType': parseInt(shippingType) + 1
}
getCouponsOrderPrice(this.totalPrice, data).then(res => {
that.$set(that.coupon, 'list', res.data);

File diff suppressed because it is too large Load Diff

View File

@ -1,469 +1,470 @@
<template>
<view class='productSort copy-data' :style="{height:pageHeight}">
<!-- #ifdef APP-PLUS || MP -->
<!-- <view class="sys-head" :style="{height:sysHeight}"></view> -->
<!-- #endif -->
<view class='header acea-row row-center-wrapper'>
<view class='acea-row row-between-wrapper input'>
<text class='iconfont icon-sousuo'></text>
<input type='text' :placeholder="$t('搜索商品名称')" @confirm="searchSubmitValue" confirm-type='search'
name="search" placeholder-class='placeholder'></input>
</view>
</view>
<view class="scroll-box">
<view class='aside'>
<scroll-view scroll-y="true" scroll-with-animation='true' style="height: calc(100% - 100rpx)">
<view class='item acea-row row-center-wrapper' :class='index==navActive?"on":""'
v-for="(item,index) in productList" :key="index" @click='tap(index,"b"+index)'>
<text>{{$t(item.cate_name)}}</text>
</view>
<!-- #ifdef APP-PLUS -->
<view class="item" v-if="newData.status && newData.status.status"></view>
<!-- #endif -->
</scroll-view>
</view>
<view class='conter'>
<scroll-view scroll-y="true" :scroll-into-view="toView" @scroll="scroll" scroll-with-animation='true'
style="height: 100%;" class="conterScroll">
<block v-for="(item,index) in productList" :key="index">
<view class='listw' :id="'b'+index">
<view class='title acea-row row-center-wrapper'>
<view class='line'></view>
<view class='name'>{{$t(item.cate_name)}}</view>
<view class='line'></view>
</view>
<view class='list acea-row'>
<block v-for="(itemn,indexn) in item.children" :key="indexn">
<navigator hover-class='none'
:url='"/pages/goods/goods_list/index?sid="+itemn.id+"&title="+itemn.cate_name'
class='item acea-row row-column row-middle'>
<view class='picture'>
<image :src='itemn.pic' v-if="itemn.pic"></image>
<image src="/static/images/sort-img.png" v-else></image>
</view>
<view class='name line1'>{{$t(itemn.cate_name)}}</view>
</navigator>
</block>
</view>
</view>
</block>
<view :style='"height:"+(height-300)+"rpx;"' v-if="number<15"></view>
</scroll-view>
</view>
</view>
<tabBar v-if="!is_diy" :pagePath="'/pages/goods_cate/goods_cate'"></tabBar>
<view class="foot" v-else-if="is_diy && newData.status && newData.status.status">
<view class="page-footer" id="target" :style="{'background-color':newData.bgColor.color[0].item}">
<view class="foot-item" v-for="(item,index) in newData.menuList" :key="index" @click="goRouter(item)">
<block v-if="item.link == activeRouter">
<image :src="item.imgList[0]"></image>
<view class="txt" :style="{color:newData.activeTxtColor.color[0].item}">{{$t(item.name)}}</view>
</block>
<block v-else>
<image :src="item.imgList[1]"></image>
<view class="txt" :style="{color:newData.txtColor.color[0].item}">{{$t(item.name)}}</view>
</block>
<div class="count-num" v-if="item.link === '/pages/order_addcart/order_addcart' && cartNum > 0">
{{cartNum}}
</div>
</view>
</view>
</view>
</view>
</template>
<script>
let sysHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
import {
getCategoryList
} from '@/api/store.js';
import {
mapState,
mapGetters
} from "vuex"
import pageFooter from '@/components/pageFooter/index.vue'
import {
getNavigation
} from '@/api/public.js'
import tabBar from "@/pages/index/visualization/components/tabBar.vue";
const app = getApp();
export default {
components: {
pageFooter,
tabBar
},
data() {
return {
navlist: [],
productList: [],
navActive: 0,
number: "",
is_diy: uni.getStorageSync('is_diy'),
height: 0,
hightArr: [],
toView: "",
tabbarH: 0,
footH: 0,
windowHeight: 0,
newData: {},
activeRouter: '',
pageHeight: '100%',
sysHeight: sysHeight,
// #ifdef APP-PLUS
pageHeight: app.globalData.windowHeight,
// #endif
footerStatus: false,
lock: false
}
},
computed: {
...mapState({
cartNum: state => state.indexData.cartNum
})
},
mounted() {
let that = this
let routes = getCurrentPages();
let curRoute = routes[routes.length - 1].route
this.activeRouter = '/' + curRoute
this.getAllCategory();
// if (uni.getStorageSync('FOOTER_BAR')) {
// this.footerStatus = true
// uni.hideTabBar()
// getNavigation().then(res => {
// this.newData = res.data
// })
// }
// #ifdef H5
uni.getSystemInfo({
success: function(res) {
that.pageHeight = res.windowHeight + 'px'
}
});
// #endif
},
methods: {
getNav() {
getNavigation().then(res => {
this.newData = res.data
if (this.newData.status && this.newData.status.status) {
uni.hideTabBar()
} else {
uni.showTabBar()
}
})
},
goRouter(item) {
var pages = getCurrentPages();
var page = (pages[pages.length - 1]).$page.fullPath;
if (item.link == page) return
uni.switchTab({
url: item.link,
fail(err) {
uni.redirectTo({
url: item.link
})
}
})
},
footHeight(data) {
this.footH = data
},
infoScroll: function() {
let that = this;
let len = that.productList.length;
this.number = that.productList[len - 1].children.length;
//设置商品列表高度
uni.getSystemInfo({
success: function(res) {
that.height = (res.windowHeight) * (750 / res.windowWidth) - 98;
},
});
let height = 0;
let hightArr = [];
for (let i = 0; i < len; i++) {
//获取元素所在位置
let query = uni.createSelectorQuery().in(this);
let idView = "#b" + i;
query.select(idView).boundingClientRect();
query.exec(function(res) {
let top = res[0].top;
hightArr.push(top);
that.hightArr = hightArr
});
};
},
tap: function(index, id) {
this.toView = id;
this.navActive = index;
this.$set(this, 'lock', true);
},
getAllCategory: function() {
let that = this;
getCategoryList().then(res => {
that.productList = res.data;
that.$nextTick(res => {
that.infoScroll();
})
})
},
scroll: function(e) {
let scrollTop = e.detail.scrollTop;
let scrollArr = this.hightArr;
if (this.lock) {
this.$set(this, 'lock', false);
return;
}
for (let i = 0; i < scrollArr.length; i++) {
if (scrollTop >= 0 && scrollTop < scrollArr[1] - scrollArr[0]) {
this.navActive = 0
} else if (scrollTop >= scrollArr[i] - scrollArr[0] && scrollTop < scrollArr[i + 1] - scrollArr[
0]) {
this.navActive = i
} else if (scrollTop >= scrollArr[scrollArr.length - 1] - scrollArr[0]) {
this.navActive = scrollArr.length - 1
}
}
},
searchSubmitValue: function(e) {
if (this.$util.trim(e.detail.value).length > 0)
uni.navigateTo({
url: '/pages/goods/goods_list/index?searchValue=' + e.detail.value
})
else
return this.$util.Tips({
title: this.$t(`搜索商品名称`)
});
},
}
}
</script>
<style>
page {
height: 100%;
}
</style>
<style scoped lang="scss">
/deep/uni-scroll-view {
padding-bottom: 0 !important;
}
.sys-title {
z-index: 10;
position: relative;
height: 40px;
line-height: 40px;
font-size: 30rpx;
color: #333;
background-color: #fff;
// #ifdef APP-PLUS
text-align: center;
// #endif
// #ifdef MP
text-align: left;
padding-left: 30rpx;
// #endif
}
.sys-head {
background-color: #fff;
}
.productSort {
display: flex;
flex-direction: column;
//#ifdef MP
height: calc(100vh - var(--window-top)) !important;
//#endif
//#ifndef MP
height: 100vh //#endif
}
.productSort .header {
width: 100%;
height: 96rpx;
background-color: #fff;
border-bottom: 1rpx solid #f5f5f5;
}
.productSort .header .input {
width: 700rpx;
height: 60rpx;
background-color: #f5f5f5;
border-radius: 50rpx;
box-sizing: border-box;
padding: 0 25rpx;
}
.productSort .header .input .iconfont {
font-size: 35rpx;
color: #555;
}
.productSort .header .input .placeholder {
color: #999;
}
.productSort .header .input input {
font-size: 26rpx;
height: 100%;
width: 597rpx;
}
.productSort .scroll-box {
flex: 1;
overflow: hidden;
display: flex;
}
// #ifndef MP
uni-scroll-view {
padding-bottom: 100rpx;
}
// #endif
.productSort .aside {
width: 180rpx;
height: 100%;
overflow: hidden;
background-color: #f7f7f7;
}
.productSort .aside .item {
height: 100rpx;
width: 100%;
font-size: 26rpx;
color: #424242;
text-align: center;
}
.productSort .aside .item.on {
background-color: #fff;
border-left: 4rpx solid var(--view-theme);
width: 100%;
color: var(--view-theme);
font-weight: bold;
}
.productSort .conter {
flex: 1;
height: 100%;
overflow: hidden;
padding: 0 14rpx;
background-color: #fff;
position: relative;
}
.productSort .conter .listw {
padding-top: 20rpx;
}
.productSort .conter .listw .title {
height: 90rpx;
}
.productSort .conter .listw .title .line {
width: 100rpx;
height: 2rpx;
background-color: #f0f0f0;
}
.productSort .conter .listw .title .name {
font-size: 28rpx;
color: #333;
margin: 0 30rpx;
font-weight: bold;
}
.productSort .conter .list {
flex-wrap: wrap;
}
.productSort .conter .list .item {
width: 177rpx;
margin-top: 26rpx;
}
.productSort .conter .list .item .picture {
width: 120rpx;
height: 120rpx;
border-radius: 50%;
}
.productSort .conter .list .item .picture image {
width: 100%;
height: 100%;
border-radius: 50%;
}
.productSort .conter .list .item .name {
font-size: 24rpx;
color: #333;
height: 56rpx;
line-height: 56rpx;
width: 120rpx;
text-align: center;
}
.page-footer {
position: fixed;
bottom: 0;
z-index: 30;
display: flex;
align-items: center;
justify-content: space-around;
width: 100%;
height: calc(98rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
height: calc(98rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
box-sizing: border-box;
border-top: solid 1rpx #F3F3F3;
background-color: #fff;
box-shadow: 0px 0px 17rpx 1rpx rgba(206, 206, 206, 0.32);
padding-bottom: constant(safe-area-inset-bottom); ///兼容 IOS<11.2/
padding-bottom: env(safe-area-inset-bottom); ///兼容 IOS>11.2/
.foot-item {
display: flex;
width: max-content;
align-items: center;
justify-content: center;
flex-direction: column;
position: relative;
.count-num {
position: absolute;
display: flex;
justify-content: center;
align-items: center;
width: 40rpx;
height: 40rpx;
top: 0rpx;
right: -15rpx;
color: #fff;
font-size: 20rpx;
background-color: #FD502F;
border-radius: 50%;
padding: 4rpx;
}
}
.foot-item image {
height: 50rpx;
width: 50rpx;
text-align: center;
margin: 0 auto;
}
.foot-item .txt {
font-size: 24rpx;
&.active {}
}
}
<template>
<view class='productSort copy-data' :style="{height:pageHeight}">
<!-- #ifdef APP-PLUS || MP -->
<!-- <view class="sys-head" :style="{height:sysHeight}"></view> -->
<!-- #endif -->
<view class='header acea-row row-center-wrapper'>
<view class='acea-row row-between-wrapper input'>
<text class='iconfont icon-sousuo'></text>
<input type='text' :placeholder="$t('搜索商品名称')" @confirm="searchSubmitValue" confirm-type='search'
name="search" placeholder-class='placeholder'></input>
</view>
</view>
<view class="scroll-box">
<view class='aside'>
<scroll-view scroll-y="true" scroll-with-animation='true' style="height: calc(100% - 100rpx)">
<view class='item acea-row row-center-wrapper' :class='index==navActive?"on":""'
v-for="(item,index) in productList" :key="index" @click='tap(index,"b"+index)'>
<text>{{$t(item.cate_name)}}</text>
</view>
<!-- #ifdef APP-PLUS -->
<view class="item" v-if="newData.status && newData.status.status"></view>
<!-- #endif -->
</scroll-view>
</view>
<view class='conter'>
<scroll-view scroll-y="true" :scroll-into-view="toView" @scroll="scroll" scroll-with-animation='true'
style="height: 100%;" class="conterScroll">
<block v-for="(item,index) in productList" :key="index">
<view class='listw' :id="'b'+index">
<view class='title acea-row row-center-wrapper'>
<view class='line'></view>
<view class='name'>{{$t(item.cate_name)}}</view>
<view class='line'></view>
</view>
<view class='list acea-row'>
<block v-for="(itemn,indexn) in item.children" :key="indexn">
<navigator hover-class='none'
:url='"/pages/goods/goods_list/index?sid="+itemn.id+"&title="+itemn.cate_name'
class='item acea-row row-column row-middle'>
<view class='picture'>
<image :src='itemn.pic' v-if="itemn.pic"></image>
<image src="/static/images/sort-img.png" v-else></image>
</view>
<view class='name line1'>{{$t(itemn.cate_name)}}</view>
</navigator>
</block>
</view>
</view>
</block>
<view :style='"height:"+(height-300)+"rpx;"' v-if="number<15"></view>
</scroll-view>
</view>
</view>
<tabBar v-if="!is_diy" :pagePath="'/pages/goods_cate/goods_cate'"></tabBar>
<view class="foot" v-else-if="is_diy && newData.status && newData.status.status">
<view class="page-footer" id="target" :style="{'background-color':newData.bgColor.color[0].item}">
<view class="foot-item" v-for="(item,index) in newData.menuList" :key="index" @click="goRouter(item)">
<block v-if="item.link == activeRouter">
<image :src="item.imgList[0]"></image>
<view class="txt" :style="{color:newData.activeTxtColor.color[0].item}">{{$t(item.name)}}</view>
</block>
<block v-else>
<image :src="item.imgList[1]"></image>
<view class="txt" :style="{color:newData.txtColor.color[0].item}">{{$t(item.name)}}</view>
</block>
<div class="count-num" v-if="item.link === '/pages/order_addcart/order_addcart' && cartNum > 0">
{{cartNum}}
</div>
</view>
</view>
</view>
</view>
</template>
<script>
let sysHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
import {
getCategoryList
} from '@/api/store.js';
import {
mapState,
mapGetters
} from "vuex"
import pageFooter from '@/components/pageFooter/index.vue'
import {
getNavigation
} from '@/api/public.js'
import tabBar from "@/pages/index/visualization/components/tabBar.vue";
const app = getApp();
export default {
components: {
pageFooter,
tabBar
},
data() {
return {
navlist: [],
productList: [],
navActive: 0,
number: "",
is_diy: uni.getStorageSync('is_diy'),
height: 0,
hightArr: [],
toView: "",
tabbarH: 0,
footH: 0,
windowHeight: 0,
newData: {},
activeRouter: '',
pageHeight: '100%',
sysHeight: sysHeight,
// #ifdef APP-PLUS
pageHeight: app.globalData.windowHeight,
// #endif
footerStatus: false,
lock: false
}
},
computed: {
...mapState({
cartNum: state => state.indexData.cartNum
})
},
mounted() {
let that = this
// #ifdef H5
uni.getSystemInfo({
success: function(res) {
that.pageHeight = res.windowHeight + 'px'
}
});
// #endif
let routes = getCurrentPages();
let curRoute = routes[routes.length - 1].route
this.activeRouter = '/' + curRoute
this.getAllCategory();
// if (uni.getStorageSync('FOOTER_BAR')) {
// this.footerStatus = true
// uni.hideTabBar()
// getNavigation().then(res => {
// this.newData = res.data
// })
// }
},
methods: {
getNav() {
getNavigation().then(res => {
this.newData = res.data
if (this.newData.status && this.newData.status.status) {
uni.hideTabBar()
} else {
uni.showTabBar()
}
})
},
goRouter(item) {
var pages = getCurrentPages();
var page = (pages[pages.length - 1]).$page.fullPath;
if (item.link == page) return
uni.switchTab({
url: item.link,
fail(err) {
uni.redirectTo({
url: item.link
})
}
})
},
footHeight(data) {
this.footH = data
},
infoScroll: function() {
let that = this;
let len = that.productList.length;
this.number = that.productList[len - 1].children.length;
//设置商品列表高度
uni.getSystemInfo({
success: function(res) {
that.height = (res.windowHeight) * (750 / res.windowWidth) - 98;
},
});
let height = 0;
let hightArr = [];
for (let i = 0; i < len; i++) {
//获取元素所在位置
let query = uni.createSelectorQuery().in(this);
let idView = "#b" + i;
query.select(idView).boundingClientRect();
query.exec(function(res) {
let top = res[0].top;
hightArr.push(top);
that.hightArr = hightArr
});
};
},
tap: function(index, id) {
this.toView = id;
this.navActive = index;
this.$set(this, 'lock', true);
},
getAllCategory: function() {
let that = this;
getCategoryList().then(res => {
that.productList = res.data;
that.$nextTick(res => {
that.infoScroll();
})
})
},
scroll: function(e) {
let scrollTop = e.detail.scrollTop;
let scrollArr = this.hightArr;
if (this.lock) {
this.$set(this, 'lock', false);
return;
}
for (let i = 0; i < scrollArr.length; i++) {
if (scrollTop >= 0 && scrollTop < scrollArr[1] - scrollArr[0]) {
this.navActive = 0
} else if (scrollTop >= scrollArr[i] - scrollArr[0] && scrollTop < scrollArr[i + 1] - scrollArr[
0]) {
this.navActive = i
} else if (scrollTop >= scrollArr[scrollArr.length - 1] - scrollArr[0]) {
this.navActive = scrollArr.length - 1
}
}
},
searchSubmitValue: function(e) {
if (this.$util.trim(e.detail.value).length > 0)
uni.navigateTo({
url: '/pages/goods/goods_list/index?searchValue=' + e.detail.value
})
else
return this.$util.Tips({
title: this.$t(`搜索商品名称`)
});
},
}
}
</script>
<style>
page {
height: 100%;
}
</style>
<style scoped lang="scss">
/deep/uni-scroll-view {
padding-bottom: 0 !important;
}
.sys-title {
z-index: 10;
position: relative;
height: 40px;
line-height: 40px;
font-size: 30rpx;
color: #333;
background-color: #fff;
// #ifdef APP-PLUS
text-align: center;
// #endif
// #ifdef MP
text-align: left;
padding-left: 30rpx;
// #endif
}
.sys-head {
background-color: #fff;
}
.productSort {
display: flex;
flex-direction: column;
//#ifdef MP
height: calc(100vh - var(--window-top)) !important;
//#endif
//#ifndef MP
height: 100vh //#endif
}
.productSort .header {
width: 100%;
height: 96rpx;
background-color: #fff;
border-bottom: 1rpx solid #f5f5f5;
}
.productSort .header .input {
width: 700rpx;
height: 60rpx;
background-color: #f5f5f5;
border-radius: 50rpx;
box-sizing: border-box;
padding: 0 25rpx;
}
.productSort .header .input .iconfont {
font-size: 35rpx;
color: #555;
}
.productSort .header .input .placeholder {
color: #999;
}
.productSort .header .input input {
font-size: 26rpx;
height: 100%;
width: 597rpx;
}
.productSort .scroll-box {
flex: 1;
overflow: hidden;
display: flex;
}
// #ifndef MP
uni-scroll-view {
padding-bottom: 100rpx;
}
// #endif
.productSort .aside {
width: 180rpx;
height: 100%;
overflow: hidden;
background-color: #f7f7f7;
}
.productSort .aside .item {
height: 100rpx;
width: 100%;
font-size: 26rpx;
color: #424242;
text-align: center;
}
.productSort .aside .item.on {
background-color: #fff;
border-left: 4rpx solid var(--view-theme);
width: 100%;
color: var(--view-theme);
font-weight: bold;
}
.productSort .conter {
flex: 1;
height: 100%;
overflow: hidden;
padding: 0 14rpx;
background-color: #fff;
position: relative;
}
.productSort .conter .listw {
padding-top: 20rpx;
}
.productSort .conter .listw .title {
height: 90rpx;
}
.productSort .conter .listw .title .line {
width: 100rpx;
height: 2rpx;
background-color: #f0f0f0;
}
.productSort .conter .listw .title .name {
font-size: 28rpx;
color: #333;
margin: 0 30rpx;
font-weight: bold;
}
.productSort .conter .list {
flex-wrap: wrap;
}
.productSort .conter .list .item {
width: 177rpx;
margin-top: 26rpx;
}
.productSort .conter .list .item .picture {
width: 120rpx;
height: 120rpx;
border-radius: 50%;
}
.productSort .conter .list .item .picture image {
width: 100%;
height: 100%;
border-radius: 50%;
}
.productSort .conter .list .item .name {
font-size: 24rpx;
color: #333;
height: 56rpx;
line-height: 56rpx;
width: 120rpx;
text-align: center;
}
.page-footer {
position: fixed;
bottom: 0;
z-index: 30;
display: flex;
align-items: center;
justify-content: space-around;
width: 100%;
height: calc(98rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
height: calc(98rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
box-sizing: border-box;
border-top: solid 1rpx #F3F3F3;
background-color: #fff;
box-shadow: 0px 0px 17rpx 1rpx rgba(206, 206, 206, 0.32);
padding-bottom: constant(safe-area-inset-bottom); ///兼容 IOS<11.2/
padding-bottom: env(safe-area-inset-bottom); ///兼容 IOS>11.2/
.foot-item {
display: flex;
width: max-content;
align-items: center;
justify-content: center;
flex-direction: column;
position: relative;
.count-num {
position: absolute;
display: flex;
justify-content: center;
align-items: center;
width: 40rpx;
height: 40rpx;
top: 0rpx;
right: -15rpx;
color: #fff;
font-size: 20rpx;
background-color: #FD502F;
border-radius: 50%;
padding: 4rpx;
}
}
.foot-item image {
height: 50rpx;
width: 50rpx;
text-align: center;
margin: 0 auto;
}
.foot-item .txt {
font-size: 24rpx;
&.active {}
}
}
</style>

View File

@ -462,7 +462,6 @@
import kefuIcon from "@/components/kefuIcon";
import menuIcon from "@/components/menuIcon.vue";
import {
silenceBindingSpread,
updateURLParameter
} from "@/utils";
import ClipboardJS from "@/plugin/clipboard/clipboard.js";
@ -663,14 +662,8 @@
} else {
that.id = options.id;
}
//记录推广人uid
if (options.spid) app.globalData.spid = options.spid;
// #endif
that.getGoodsDetails();
// that.getCouponList(0);
//#ifdef H5
that.isLogin && silenceBindingSpread();
//#endif
},
onReady: function() {
this.isNodes++;

View File

@ -9,7 +9,7 @@
<navigator url="/pages/goods/goods_search/index" class="input acea-row row-middle skeleton-rect"
:class="[boxStyle?'':'fillet',logoConfig?'':'on',txtStyle?'row-center':'']" hover-class="none"><text
class="iconfont icon-sousuo"></text>
{{$t(`搜索商品名称`)}}</navigator>
{{$t(`搜索商品`)}}</navigator>
</view>
</view>
<!-- #endif -->

View File

@ -162,10 +162,10 @@
listStyle: this.dataConfig.listStyle.type,
mbConfig: this.dataConfig.mbConfig.val,
liveList: [],
custom_params:''
custom_params:'',
// bg:this.dataConfig.bg.color[0].item,
// boxShadow: this.dataConfig.boxShadow.color[0].item,
// limit:this.dataConfig.limit.val
limit:this.dataConfig.limit.val
};
},
created() {},

View File

@ -1,92 +1,97 @@
<template>
<diy ref="diy" v-if="isDiy"></diy>
<visualization v-else></visualization>
</template>
<script>
import diy from './diy'
import visualization from './visualization'
import {
getShare
} from "@/api/public.js";
export default {
data() {
return {
isDiy: uni.getStorageSync('is_diy'),
shareInfo: {}
}
},
components: {
diy,
visualization
},
onShow() {
uni.$on('is_diy', (data) => {
this.isDiy = data
})
this.setOpenShare();
},
onHide() {
// this.isDiy = -1
},
methods: {
// 微信分享;
setOpenShare: function() {
let that = this;
getShare().then((res) => {
let data = res.data;
this.shareInfo = data;
// #ifdef H5
let url = location.href;
if (this.$store.state.app.uid) {
url =
url.indexOf("?") === -1 ?
url + "?spread=" + this.$store.state.app.uid :
url + "&spread=" + this.$store.state.app.uid;
}
if (that.$wechat.isWeixin()) {
let configAppMessage = {
desc: data.synopsis,
title: data.title,
link: url,
imgUrl: data.img,
};
that.$wechat.wechatEvevt(
["updateAppMessageShareData", "updateTimelineShareData"],
configAppMessage
);
}
// #endif
});
},
},
onReachBottom: function() {
if (this.isDiy) {
this.$refs.diy.onsollBotton()
}
},
// #ifdef MP
//发送给朋友
onShareAppMessage(res) {
// 此处的distSource为分享者的部分信息,需要传递给其他人
let that = this;
return {
title: this.shareInfo.title,
path: "/pages/index/index",
imageUrl: this.shareInfo.img,
};
},
//分享到朋友圈
onShareTimeline() {
return {
title: this.shareInfo.title,
imageUrl: this.shareInfo.img,
};
},
// #endif
}
</script>
<style>
<template>
<diy ref="diy" v-if="isDiy"></diy>
<visualization v-else></visualization>
</template>
<script>
import diy from './diy'
import visualization from './visualization'
import Cache from '@/utils/cache';
import {
getShare
} from "@/api/public.js";
let app = getApp();
export default {
data() {
return {
isDiy: uni.getStorageSync('is_diy'),
shareInfo: {}
}
},
components: {
diy,
visualization
},
onShow() {
uni.$on('is_diy', (data) => {
this.isDiy = data
})
this.setOpenShare();
},
onHide() {
// this.isDiy = -1
},
methods: {
// 微信分享;
setOpenShare: function() {
let that = this;
getShare().then((res) => {
let data = res.data;
this.shareInfo = data;
// #ifdef H5
let url = location.href;
if (this.$store.state.app.uid) {
url =
url.indexOf("?") === -1 ?
url + "?spread=" + this.$store.state.app.uid :
url + "&spread=" + this.$store.state.app.uid;
}
if (that.$wechat.isWeixin()) {
let configAppMessage = {
desc: data.synopsis,
title: data.title,
link: url,
imgUrl: data.img,
};
that.$wechat.wechatEvevt(
["updateAppMessageShareData", "updateTimelineShareData"],
configAppMessage
);
}
// #endif
});
},
},
onReachBottom: function() {
if (this.isDiy) {
this.$refs.diy.onsollBotton()
}
},
// #ifdef MP
//发送给朋友
onShareAppMessage(res) {
// 此处的distSource为分享者的部分信息,需要传递给其他人
let that = this;
return {
title: this.shareInfo.title,
path: "/pages/index/index?spid=" + this.$store.state.app.uid || 0,
imageUrl: this.shareInfo.img,
};
},
//分享到朋友圈
onShareTimeline() {
return {
title: this.shareInfo.title,
query: {
spid: this.$store.state.app.uid || 0
},
imageUrl: this.shareInfo.img,
};
},
// #endif
}
</script>
<style>
</style>

View File

@ -4,7 +4,7 @@
<view class="serch-wrapper row-middle">
<view class="logo">
<image class="skeleton-rect" :src="logoConfig" mode="heightFix"></image>
<view class="swiger">{{titleInfo.length ? titleInfo[0].val : ''}}</view>
<view class="swiger">{{titleInfo.length ? $t(titleInfo[0].val) : ''}}</view>
</view>
<view class="input acea-row row-middle fillet skeleton-rect" hover-class="none" @click="goPage"><text

View File

@ -6,7 +6,7 @@
<view class='pictrue'>
<image class="skeleton-radius" :src='item.img'></image>
</view>
<view class="menu-txt">{{item.info[0].value}}</view>
<view class="menu-txt">{{$t(item.info[0].value)}}</view>
</view>
</block>
</view>

View File

@ -7,10 +7,10 @@
<view class='text'>
<view class='name line1'>
<text class="iconfont icon-shoufaxinpin"></text>
{{titleInfo[0].val}}
{{$t(titleInfo[0].val)}}
<!-- <text class='new font-color'>NEW~</text> -->
</view>
<view class='line1 txt-btn'>{{titleInfo[1].val}}</view>
<view class='line1 txt-btn'>{{$t(titleInfo[1].val)}}</view>
</view>
<view class='more' @click="gopage(titleInfo[2].val)">
{{$t(`更多`)}}

View File

@ -17,10 +17,10 @@
<view class='text'>
<view class='name line1'>
<text class="iconfont icon-shoufaxinpin"></text>
{{titleInfo[0].val}}
{{$t(titleInfo[0].val)}}
<!-- <text class='new font-color'>NEW~</text> -->
</view>
<view class='line1 txt-btn'>{{titleInfo[1].val}}</view>
<view class='line1 txt-btn'>{{$t(titleInfo[1].val)}}</view>
</view>
<view class='more' @click="gopage(titleInfo[2].val)">
{{$t(`更多`)}}

View File

@ -5,8 +5,8 @@
<view class='title acea-row row-between-wrapper'>
<view class='text'>
<view class='name line1'><text class="iconfont icon-cuxiaodanpin"></text>{{titleInfo[0].val}}</view>
<view class='line1 txt-btn'>{{titleInfo[1].val}}</view>
<view class='name line1'><text class="iconfont icon-cuxiaodanpin"></text>{{$t(titleInfo[0].val)}}</view>
<view class='line1 txt-btn'>{{$t(titleInfo[1].val)}}</view>
</view>
<view class='more' @click="gopage(titleInfo[2].val)">{{$t(`更多`)}}<text class='iconfont icon-jiantou'></text>
</view>

View File

@ -6,9 +6,9 @@
<view class='text'>
<view class='name line1'>
<text class="iconfont icon-jingpintuijian1"></text>
{{titleInfo[0].val}}
{{$t(titleInfo[0].val)}}
</view>
<view class='line1 txt-btn'>{{titleInfo[1].val}}</view>
<view class='line1 txt-btn'>{{$t(titleInfo[1].val)}}</view>
</view>
<view class='more' @click="gopage(titleInfo[2].val)">
{{$t(`更多`)}}

View File

@ -3,8 +3,8 @@
<view class='index-wrapper skeleton-rect' v-if="isShow && fastList.length">
<view class='title acea-row row-between-wrapper'>
<view class='text'>
<view class='name line1'>{{titleInfo[0].val}}</view>
<view class='line1 txt-btn'>{{titleInfo[1].val}}</view>
<view class='name line1'>{{$t(titleInfo[0].val)}}</view>
<view class='line1 txt-btn'>{{$t(titleInfo[1].val)}}</view>
</view>
<navigator class='more' open-type="switchTab" :url="titleInfo[2].val">{{$t(`更多`)}}<text
class='iconfont icon-jiantou'></text></navigator>
@ -17,7 +17,7 @@
<view class='img-box'>
<image :src='item.pic'></image>
</view>
<view class='pro-info line1'>{{item.cate_name}}</view>
<view class='pro-info line1'>{{$t(item.cate_name)}}</view>
</view>
</block>
</scroll-view>

View File

@ -1,295 +1,301 @@
<template>
<view class="swiperBg" :style="{marginTop:mt +'rpx'}">
<view class="bag" v-if="isIframe || (imgUrls.length && isShow)">
</view>
<block v-if="isShow && imgUrls.length">
<view class="swiper square" v-if="imgUrls.length">
<swiper class="skeleton-rect" :style="'height:'+ (imageH) +'rpx;'" indicator-dots="true"
:autoplay="true" :circular="circular" :interval="interval" :duration="duration"
indicator-color="rgba(255,255,255,0.6)" indicator-active-color="#fff" :current="swiperCur"
@change="swiperChange">
<block v-for="(item,index) in imgUrls" :key="index">
<swiper-item class="" :class="{active:index == swiperCur}">
<view @click="goDetail(item)" class='slide-navigator acea-row row-between-wrapper'>
<image :src="item.img" class="slide-image" mode="widthFix"
:style="'height:'+ (imageH) +'rpx;'">
</image>
</view>
</swiper-item>
</block>
</swiper>
</view>
</block>
<block v-if="!isShow && isIframe && imgUrls.length && imageH">
<view class="swiper square" v-if="imgUrls.length && imageH" :style="'height:'+ (imageH) +'rpx;'">
<swiper :style="'height:'+ (imageH) +'rpx;'" indicator-dots="true" :autoplay="true" :circular="circular"
:interval="interval" :duration="duration" indicator-color="rgba(255,255,255,0.6)"
indicator-active-color="#fff">
<block v-for="(item,index) in imgUrls" :key="index">
<swiper-item>
<view @click="goDetail(item)" class='slide-navigator acea-row row-between-wrapper'>
<image :src="item.img" class="slide-image" mode="widthFix"
:style="'height:'+ (imageH) +'rpx;'">
</image>
</view>
</swiper-item>
</block>
</swiper>
</view>
</block>
<block v-if="isIframe && (!imgUrls.length || !imageH)">
<view class="empty-img">{{$t(`暂无图片,请上传图片`)}}</view>
</block>
</view>
</template>
<script>
let statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
let app = getApp();
import {
goPage
} from '@/libs/order.js'
export default {
name: 'swiperBg',
props: {
dataConfig: {
type: Object,
default: () => {}
},
},
watch: {
dataConfig: {
immediate: true,
handler(nVal, oVal) {
if (nVal) {
this.imgUrls = nVal.imgList ? nVal.imgList.list : [];
this.isShow = nVal.isShow ? nVal.isShow.val : true
uni.getImageInfo({
src: this.imgUrls.length ? this.imgUrls[0].img : '',
success: (res) => {
if (res && res.height > 0) {
this.$set(this, 'imageH',
res.height / res
.width * 690)
} else {
this.$set(this, 'imageH', 320);
}
},
fail: (error) => {
this.$set(this, 'imageH', 320);
}
})
}
}
},
imageH(nVal, oVal) {
let self = this
},
},
data() {
return {
indicatorDots: false,
circular: true,
autoplay: true,
interval: 4000,
duration: 500,
imgUrls: [], //图片轮播数据
name: this.$options.name,
isIframe: false,
mt: -55,
isShow: true,
imageH: 320,
swiperCur: 0,
};
},
created() {
// #ifdef MP || APP-PLUS
const res = uni.getSystemInfoSync()
const system = res.platform
this.statusBarHeight = res.statusBarHeight
if (system === 'android') {
this.mt = parseFloat(statusBarHeight) * 2 + 170
} else {
this.mt = parseFloat(statusBarHeight) * 2 + 168
}
// #endif
this.isIframe = app.globalData.isIframe;
},
mounted() {},
methods: {
goDetail(url) {
goPage().then(res => {
let urls = url.info[1].value
if (urls) {
if (urls.indexOf("http") != -1) {
// #ifdef H5
location.href = urls
// #endif
} else {
if (['/pages/goods_cate/goods_cate', '/pages/order_addcart/order_addcart',
'/pages/user/index'
].indexOf(urls) ==
-1) {
uni.navigateTo({
url: urls
})
} else {
uni.reLaunch({
url: urls
})
}
}
}
})
},
//替换安全域名
setDomain: function(url) {
url = url ? url.toString() : '';
//本地调试打开,生产请注销
if (url.indexOf("https://") > -1) return url;
else return url.replace('http://', 'https://');
},
swiperChange(e) {
// this.swiperCur = e.detail.current
let {
current,
source
} = e.detail
if (source === 'autoplay' || source === 'touch') {
//根据官方 source 来进行判断swiper的change事件是通过什么来触发的,autoplay是自动轮播。touch是用户手动滑动。其他的就是未知问题。抖动问题主要由于未知问题引起的,所以做了限制,只有在自动轮播和用户主动触发才去改变current值,达到规避了抖动bug
this.swiperCur = e.detail.current
}
},
}
}
</script>
<style lang="scss">
.swiperBg /deep/ .uni-swiper-slides {
overflow: hidden;
border-radius: 10rpx;
}
.swiperBg {
background-color: #fff;
position: relative;
margin-top: -20rpx;
padding-top: 4rpx;
.bag {
position: absolute;
top: 0;
width: 100%;
height: 140rpx;
background: linear-gradient(90deg, var(--view-main-start) 0%, var(--view-main-over) 100%);
border-bottom-left-radius: 40rpx;
border-bottom-right-radius: 40rpx;
}
/* #ifdef APP-PLUS */
/* #endif */
.colorBg {
position: absolute;
left: 0;
top: 0;
height: 130rpx;
width: 100%;
}
.swiper {
z-index: 100;
position: relative;
min-height: 200rpx;
padding: 0 $uni-index-margin-col;
/* #ifdef APP-PLUS */
// margin: 0rpx auto 0 auto;
/* #endif */
overflow: hidden;
/* #ifdef MP */
/* #endif */
/* 设置圆角 */
&.fillet {
border-radius: 10rpx;
image {
border-radius: 10rpx;
}
}
swiper,
.swiper-item,
image {
width: 100%;
overflow: hidden;
border-radius: 10rpx;
}
.slide-navigator {}
image {
transform: scale(1);
// transition: all .3s ease;
}
swiper-item.active {
image {
transform: scale(1);
}
}
// 圆形指示点
&.circular {
/deep/.uni-swiper-dot {
width: 10rpx !important;
height: 10rpx !important;
background: rgba(0, 0, 0, .4) !important
}
/deep/.uni-swiper-dot-active {
background: #fff !important
}
}
// 方形指示点
&.square {
/deep/.uni-swiper-dot {
width: 20rpx !important;
height: 5rpx !important;
border-radius: 3rpx;
background: rgba(0, 0, 0, .4) !important
}
/deep/.uni-swiper-dot-active {
background: #fff !important
}
}
}
}
.item-img image {
display: block;
width: 100%;
border-radius: 10rpx;
}
.empty-img {
width: 690rpx;
height: 300rpx;
border-radius: 14rpx;
margin: 26rpx auto 0 auto;
background-color: #ccc;
text-align: center;
line-height: 300rpx;
position: relative;
.iconfont {
font-size: 50rpx;
}
}
<template>
<view class="swiperBg" :style="{marginTop:mt +'rpx'}">
<view class="bag" v-if="isIframe || (imgUrls.length && isShow)">
</view>
<block v-if="isShow && imgUrls.length">
<view class="swiper square" v-if="imgUrls.length">
<swiper class="skeleton-rect" :style="'height:'+ (imageH) +'rpx;'" indicator-dots="true"
:autoplay="true" :circular="circular" :interval="interval" :duration="duration"
indicator-color="rgba(255,255,255,0.6)" indicator-active-color="#fff" :current="swiperCur"
@change="swiperChange">
<block v-for="(item,index) in imgUrls" :key="index">
<swiper-item class="" :class="{active:index == swiperCur}">
<view @click="goDetail(item)" class='slide-navigator acea-row row-between-wrapper'>
<image :src="item.img" class="slide-image" mode="widthFix"
:style="'height:'+ (imageH) +'rpx;'">
</image>
</view>
</swiper-item>
</block>
</swiper>
</view>
</block>
<block v-if="!isShow && isIframe && imgUrls.length && imageH">
<view class="swiper square" v-if="imgUrls.length && imageH" :style="'height:'+ (imageH) +'rpx;'">
<swiper :style="'height:'+ (imageH) +'rpx;'" indicator-dots="true" :autoplay="true" :circular="circular"
:interval="interval" :duration="duration" indicator-color="rgba(255,255,255,0.6)"
indicator-active-color="#fff">
<block v-for="(item,index) in imgUrls" :key="index">
<swiper-item>
<view @click="goDetail(item)" class='slide-navigator acea-row row-between-wrapper'>
<image :src="item.img" class="slide-image" mode="widthFix"
:style="'height:'+ (imageH) +'rpx;'">
</image>
</view>
</swiper-item>
</block>
</swiper>
</view>
</block>
<block v-if="isIframe && (!imgUrls.length || !imageH)">
<view class="empty-img">{{$t(`暂无图片,请上传图片`)}}</view>
</block>
</view>
</template>
<script>
let statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
let app = getApp();
import {
goPage
} from '@/libs/order.js'
export default {
name: 'swiperBg',
props: {
dataConfig: {
type: Object,
default: () => {}
},
},
watch: {
dataConfig: {
immediate: true,
handler(nVal, oVal) {
if (nVal) {
this.imgUrls = nVal.imgList ? nVal.imgList.list : [];
this.isShow = nVal.isShow ? nVal.isShow.val : true
uni.getImageInfo({
src: this.imgUrls.length ? this.imgUrls[0].img : '',
success: (res) => {
if (res && res.height > 0) {
this.$set(this, 'imageH',
res.height / res
.width * 690)
} else {
this.$set(this, 'imageH', 320);
}
},
fail: (error) => {
this.$set(this, 'imageH', 320);
}
})
}
}
},
imageH(nVal, oVal) {
let self = this
},
},
data() {
return {
indicatorDots: false,
circular: true,
autoplay: true,
interval: 4000,
duration: 500,
imgUrls: [], //图片轮播数据
name: this.$options.name,
isIframe: false,
mt: -55,
isShow: true,
imageH: 320,
swiperCur: 0,
};
},
created() {
// #ifdef MP || APP-PLUS
const res = uni.getSystemInfoSync()
const system = res.platform
this.statusBarHeight = res.statusBarHeight
if (system === 'android') {
this.mt = parseFloat(statusBarHeight) * 2 + 170
} else {
this.mt = parseFloat(statusBarHeight) * 2 + 168
}
// #endif
this.isIframe = app.globalData.isIframe;
},
mounted() {},
methods: {
goDetail(url) {
goPage().then(res => {
let urls = url.info[1].value
if (urls) {
if (urls.indexOf("http") != -1) {
// #ifdef H5
location.href = urls
// #endif
} else {
if (['/pages/goods_cate/goods_cate', '/pages/order_addcart/order_addcart',
'/pages/user/index'
].indexOf(urls) ==
-1) {
uni.navigateTo({
url: urls
})
} else {
uni.switchTab({
url: urls,
fail() {
uni.reLaunch({
url: urls
})
}
})
}
}
}
})
},
//替换安全域名
setDomain: function(url) {
url = url ? url.toString() : '';
//本地调试打开,生产请注销
if (url.indexOf("https://") > -1) return url;
else return url.replace('http://', 'https://');
},
swiperChange(e) {
// this.swiperCur = e.detail.current
let {
current,
source
} = e.detail
if (source === 'autoplay' || source === 'touch') {
//根据官方 source 来进行判断swiper的change事件是通过什么来触发的,autoplay是自动轮播。touch是用户手动滑动。其他的就是未知问题。抖动问题主要由于未知问题引起的,所以做了限制,只有在自动轮播和用户主动触发才去改变current值,达到规避了抖动bug
this.swiperCur = e.detail.current
}
},
}
}
</script>
<style lang="scss">
.swiperBg /deep/ .uni-swiper-slides {
overflow: hidden;
border-radius: 10rpx;
}
.swiperBg {
background-color: #fff;
position: relative;
margin-top: -20rpx;
padding-top: 4rpx;
.bag {
position: absolute;
top: 0;
width: 100%;
height: 140rpx;
background: linear-gradient(90deg, var(--view-main-start) 0%, var(--view-main-over) 100%);
border-bottom-left-radius: 40rpx;
border-bottom-right-radius: 40rpx;
}
/* #ifdef APP-PLUS */
/* #endif */
.colorBg {
position: absolute;
left: 0;
top: 0;
height: 130rpx;
width: 100%;
}
.swiper {
z-index: 100;
position: relative;
min-height: 200rpx;
padding: 0 $uni-index-margin-col;
/* #ifdef APP-PLUS */
// margin: 0rpx auto 0 auto;
/* #endif */
overflow: hidden;
/* #ifdef MP */
/* #endif */
/* 设置圆角 */
&.fillet {
border-radius: 10rpx;
image {
border-radius: 10rpx;
}
}
swiper,
.swiper-item,
image {
width: 100%;
overflow: hidden;
border-radius: 10rpx;
}
.slide-navigator {}
image {
transform: scale(1);
// transition: all .3s ease;
}
swiper-item.active {
image {
transform: scale(1);
}
}
// 圆形指示点
&.circular {
/deep/.uni-swiper-dot {
width: 10rpx !important;
height: 10rpx !important;
background: rgba(0, 0, 0, .4) !important
}
/deep/.uni-swiper-dot-active {
background: #fff !important
}
}
// 方形指示点
&.square {
/deep/.uni-swiper-dot {
width: 20rpx !important;
height: 5rpx !important;
border-radius: 3rpx;
background: rgba(0, 0, 0, .4) !important
}
/deep/.uni-swiper-dot-active {
background: #fff !important
}
}
}
}
.item-img image {
display: block;
width: 100%;
border-radius: 10rpx;
}
.empty-img {
width: 690rpx;
height: 300rpx;
border-radius: 14rpx;
margin: 26rpx auto 0 auto;
background-color: #ccc;
text-align: center;
line-height: 300rpx;
position: relative;
.iconfont {
font-size: 50rpx;
}
}
</style>

File diff suppressed because it is too large Load Diff

View File

@ -142,9 +142,6 @@
import {
toLogin
} from '@/libs/login.js';
import {
silenceBindingSpread
} from "@/utils";
import {
getUserInfo
} from '@/api/user.js';
@ -270,7 +267,6 @@
//res.windowHeight:获取整个窗口高度为px,*2为rpx;98为头部占据的高度;
},
});
this.isLogin && silenceBindingSpread();
// #ifdef H5
that.navH = 96;
// #endif

View File

@ -20,16 +20,10 @@
<view>
<!-- 注释这个是加的bnt -->
<!-- #ifdef H5 -->
<button class="bntImg" v-if="userInfo.is_complete == 0 && isWeixin"
<!-- <button class="bntImg" v-if="userInfo.is_complete == 0 && isWeixin"
@click="getWechatuserinfo">
<image class="avatar" src='/static/images/f.png'></image>
<view class="avatarName">{{$t('获取头像')}}</view>
</button>
<!-- #endif -->
<!-- #ifdef MP -->
<!-- <button class="bntImg" v-if="userInfo.is_complete == 0" @tap="getUserProfile">
<image class="avatar" src='/static/images/f.png'></image>
<view class="avatarName">{{$t('获取头像')}}</view>
</button> -->
<!-- #endif -->
<!-- #ifndef APP-PLUS -->

View File

@ -55,7 +55,7 @@
// 小程序获取手机号码
getphonenumber(e) {
uni.showLoading({
title: this.$t(`加载中`)
title: this.$t(`正在登录中`)
});
Routine.getCode()
.then(code => {

View File

@ -563,6 +563,7 @@
captchaVerification: data.captchaVerification
})
.then(res => {
this.sendCode()
that.$util.Tips({
title: res.msg
});

View File

@ -1,476 +1,485 @@
<template>
<view :style="colorStyle">
<view class='address-management' :class='addressList.length < 1 && page > 1 ? "fff":""'>
<view class='line'>
<image src='../../../static/images/line.jpg' v-if="addressList.length"></image>
</view>
<radio-group class="radio-group" @change="radioChange" v-if="addressList.length">
<view class='item' v-for="(item,index) in addressList" :key="index">
<view class='address' @click='goOrder(item.id)'>
<view class='consignee'>{{$t(`收货人`)}}:{{item.real_name}}<text class='phone'>{{item.phone}}</text></view>
<view>{{$t(`收货地址`)}}:{{item.province}}{{item.city}}{{item.district}}{{item.detail}}</view>
</view>
<view class='operation acea-row row-between-wrapper'>
<!-- #ifndef MP -->
<radio class="radio" :value="index.toString()" :checked="item.is_default ? true : false">
<text>{{$t(`设为默认`)}}</text>
</radio>
<!-- #endif -->
<!-- #ifdef MP -->
<radio class="radio" :value="index" :checked="item.is_default ? true : false">
<text>{{$t(`设为默认`)}}</text>
</radio>
<!-- #endif -->
<view class='acea-row row-middle'>
<view @click='editAddress(item.id)'><text class='iconfont icon-bianji'></text>{{$t(`编辑`)}}</view>
<view @click='delAddress(index)'><text class='iconfont icon-shanchu'></text>{{$t(`删除`)}}</view>
</view>
</view>
</view>
</radio-group>
<view class='loadingicon acea-row row-center-wrapper' v-if="addressList.length">
<text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
</view>
<view class='noCommodity' v-if="addressList.length < 1 && page > 1">
<view class='pictrue'>
<image :src="imgHost + '/statics/images/noAddress.png'"></image>
</view>
</view>
<view style='height:120rpx;'></view>
<view class='footer acea-row row-between-wrapper'>
<!-- #ifdef APP-PLUS -->
<view class='addressBnt on' @click='addAddress'><text
class='iconfont icon-tianjiadizhi'></text>{{$t(`添加新地址`)}}</view>
<!-- #endif -->
<!-- #ifdef MP-->
<view class='addressBnt wxbnt' @click='addAddress'><text
class='iconfont icon-tianjiadizhi'></text>{{$t(`添加新地址`)}}</view>
<view class='addressBnt' @click='getWxAddress'><text class='iconfont icon-weixin2'></text>{{$t(`导入微信地址`)}}
</view>
<!-- #endif -->
<!-- #ifdef H5-->
<view class='addressBnt' :class="this.$wechat.isWeixin()?'wxbnt':'on'" @click='addAddress'><text
class='iconfont icon-tianjiadizhi'></text>{{$t(`添加新地址`)}}</view>
<view class=""></view>
<view class='addressBnt' @click='getAddress' v-if="this.$wechat.isWeixin()"><text
class='iconfont icon-weixin2'></text>{{$t(`导入微信地址`)}}</view>
<!-- #endif -->
</view>
</view>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
<!-- #ifndef MP -->
<home></home>
<!-- #endif -->
</view>
</template>
<script>
import {
getAddressList,
setAddressDefault,
delAddress,
editAddress,
postAddress
} from '@/api/user.js';
import {
toLogin
} from '@/libs/login.js';
import {
mapGetters
} from "vuex";
// #ifdef MP
import authorize from '@/components/Authorize';
// #endif
import home from '@/components/home';
import colors from '@/mixins/color.js';
import {HTTP_REQUEST_URL} from '@/config/app';
export default {
components: {
// #ifdef MP
authorize,
// #endif
home
},
mixins:[colors],
data() {
return {
imgHost:HTTP_REQUEST_URL,
addressList: [],
cartId: '',
pinkId: 0,
couponId: 0,
loading: false,
loadend: false,
loadTitle: this.$t(`加载更多`),
page: 1,
limit: 20,
isAuto: false, //没有授权的不会自动授权
isShowAuth: false, //是否隐藏授权
news: '',
noCoupon: 0
};
},
computed: mapGetters(['isLogin']),
onLoad(options) {
if (this.isLogin) {
this.cartId = options.cartId || '';
this.noCoupon = options.noCoupon || 0;
this.pinkId = options.pinkId || 0;
this.couponId = options.couponId || 0;
this.news = options.news || 0;
this.getAddressList(true);
} else {
toLogin();
}
},
onShow: function() {
let that = this;
that.getAddressList(true);
},
methods: {
onLoadFun: function() {
this.getAddressList();
},
// 授权关闭
authColse: function(e) {
this.isShowAuth = e
},
/*
* 导入微信地址(小程序)
*/
getWxAddress: function() {
<template>
<view :style="colorStyle">
<view class='address-management' :class='addressList.length < 1 && page > 1 ? "fff":""'>
<view class='line'>
<image src='../../../static/images/line.jpg' v-if="addressList.length"></image>
</view>
<radio-group class="radio-group" @change="radioChange" v-if="addressList.length">
<view class='item' v-for="(item,index) in addressList" :key="index">
<view class='address' @click='goOrder(item.id)'>
<view class='consignee'>{{$t(`收货人`)}}:{{item.real_name}}<text
class='phone'>{{item.phone}}</text></view>
<view>{{$t(`收货地址`)}}:{{item.province}}{{item.city}}{{item.district}}{{item.detail}}</view>
</view>
<view class='operation acea-row row-between-wrapper'>
<!-- #ifndef MP -->
<radio class="radio" :value="index.toString()" :checked="item.is_default ? true : false">
<text>{{$t(`设为默认`)}}</text>
</radio>
<!-- #endif -->
<!-- #ifdef MP -->
<radio class="radio" :value="index" :checked="item.is_default ? true : false">
<text>{{$t(`设为默认`)}}</text>
</radio>
<!-- #endif -->
<view class='acea-row row-middle'>
<view @click='editAddress(item.id)'><text class='iconfont icon-bianji'></text>{{$t(`编辑`)}}
</view>
<view @click='delAddress(index)'><text class='iconfont icon-shanchu'></text>{{$t(`删除`)}}
</view>
</view>
</view>
</view>
</radio-group>
<view class='loadingicon acea-row row-center-wrapper' v-if="addressList.length">
<text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
</view>
<view class='noCommodity' v-if="addressList.length < 1 && page > 1">
<view class='pictrue'>
<image :src="imgHost + '/statics/images/noAddress.png'"></image>
</view>
</view>
<view style='height:120rpx;'></view>
<view class='footer acea-row row-between-wrapper'>
<!-- #ifdef APP-PLUS -->
<view class='addressBnt on' @click='addAddress'><text
class='iconfont icon-tianjiadizhi'></text>{{$t(`添加新地址`)}}</view>
<!-- #endif -->
<!-- #ifdef MP-->
<view class='addressBnt wxbnt' @click='addAddress'><text
class='iconfont icon-tianjiadizhi'></text>{{$t(`添加新地址`)}}</view>
<view class='addressBnt' @click='getWxAddress'><text
class='iconfont icon-weixin2'></text>{{$t(`导入微信地址`)}}
</view>
<!-- #endif -->
<!-- #ifdef H5-->
<view class='addressBnt' :class="this.$wechat.isWeixin()?'wxbnt':'on'" @click='addAddress'><text
class='iconfont icon-tianjiadizhi'></text>{{$t(`添加新地址`)}}</view>
<view class=""></view>
<view class='addressBnt' @click='getAddress' v-if="this.$wechat.isWeixin()"><text
class='iconfont icon-weixin2'></text>{{$t(`导入微信地址`)}}</view>
<!-- #endif -->
</view>
</view>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
<!-- #ifndef MP -->
<home></home>
<!-- #endif -->
</view>
</template>
<script>
import {
getAddressList,
setAddressDefault,
delAddress,
editAddress,
postAddress
} from '@/api/user.js';
import {
toLogin
} from '@/libs/login.js';
import {
mapGetters
} from "vuex";
// #ifdef MP
import authorize from '@/components/Authorize';
// #endif
import home from '@/components/home';
import colors from '@/mixins/color.js';
import {
HTTP_REQUEST_URL
} from '@/config/app';
export default {
components: {
// #ifdef MP
authorize,
// #endif
home
},
mixins: [colors],
data() {
return {
imgHost: HTTP_REQUEST_URL,
addressList: [],
cartId: '',
pinkId: 0,
couponId: 0,
loading: false,
loadend: false,
loadTitle: this.$t(`加载更多`),
page: 1,
limit: 20,
isAuto: false, //没有授权的不会自动授权
isShowAuth: false, //是否隐藏授权
news: '',
noCoupon: 0
};
},
computed: mapGetters(['isLogin']),
onLoad(options) {
if (this.isLogin) {
this.cartId = options.cartId || '';
this.noCoupon = options.noCoupon || 0;
this.pinkId = options.pinkId || 0;
this.couponId = options.couponId || 0;
this.news = options.news || 0;
this.getAddressList(true);
} else {
toLogin();
}
},
onShow: function() {
let that = this;
that.getAddressList(true);
},
methods: {
onLoadFun: function() {
this.getAddressList();
},
// 授权关闭
authColse: function(e) {
this.isShowAuth = e
},
/*
* 导入微信地址(小程序)
*/
getWxAddress: function() {
let that = this;
uni.authorize({
scope: 'scope.address',
success: function(res) {
uni.chooseAddress({
success: function(res) {
let addressP = {};
addressP.province = res.provinceName;
addressP.city = res.cityName;
console.log('111')
uni.authorize({
scope: 'scope.address',
success: function(res) {
uni.chooseAddress({
success: function(res) {
let addressP = {};
addressP.province = res.provinceName;
addressP.city = res.cityName;
addressP.district = res.countyName;
editAddress({
address: addressP,
is_default: 1,
real_name: res.userName,
post_code: res.postalCode,
phone: res.telNumber,
detail: res.detailInfo,
id: 0,
type: 1
}).then(res => {
that.$util.Tips({
title: that.$t(`添加成功`),
icon: 'success'
}, function() {
that.getAddressList(true);
});
}).catch(err => {
return that.$util.Tips({
title: err
});
});
},
fail: function(res) {
if (res.errMsg == 'chooseAddress:cancel') return that.$util
.Tips({
title: that.$t(`取消选择`)
});
},
})
},
fail: function(res) {
uni.showModal({
title: that.$t(`您已拒绝导入微信地址权限`),
content: that.$t(`是否进入权限管理,调整授权?`),
success(res) {
if (res.confirm) {
uni.openSetting({
success: function(res) {}
});
} else if (res.cancel) {
return that.$util.Tips({
title: that.$t(`已取消!`)
});
}
}
})
}
})
},
/*
* 导入微信地址(公众号)
*/
getAddress() {
let that = this;
that.$wechat.openAddress().then(userInfo => {
// open();
editAddress({
real_name: userInfo.userName,
phone: userInfo.telNumber,
address: {
province: userInfo.provinceName,
city: userInfo.cityName,
district: userInfo.countryName
},
detail: userInfo.detailInfo,
post_code: userInfo.postalCode,
is_default: 1,
type: 1
})
.then(() => {
that.$util.Tips({
title: that.$t(`添加成功`),
icon: 'success'
}, function() {
// close();
that.getAddressList(true);
});
})
.catch(err => {
// close();
return that.$util.Tips({
title: err || that.$t(`添加失败`)
});
});
});
},
/**
* 获取地址列表
*
*/
getAddressList: function(isPage) {
let that = this;
if (isPage) {
that.loadend = false;
that.page = 1;
that.$set(that, 'addressList', []);
};
if (that.loading) return;
if (that.loadend) return;
that.loading = true;
that.loadTitle = '';
getAddressList({
page: that.page,
limit: that.limit
}).then(res => {
let list = res.data;
let loadend = list.length < that.limit;
that.addressList = that.$util.SplitArray(list, that.addressList);
that.$set(that, 'addressList', that.addressList);
that.loadend = loadend;
that.loadTitle = loadend ? that.$t(`我也是有底线的`) : that.$t(`加载更多`);
that.page = that.page + 1;
that.loading = false;
}).catch(err => {
that.loading = false;
that.loadTitle = that.$t(`加载更多`);
});
},
/**
* 设置默认地址
*/
radioChange: function(e) {
let index = parseInt(e.detail.value),
that = this;
let address = this.addressList[index];
if (address == undefined) return that.$util.Tips({
title: that.$t(`您设置的默认地址不存在!`)
});
setAddressDefault(address.id).then(res => {
for (let i = 0, len = that.addressList.length; i < len; i++) {
if (i == index) that.addressList[i].is_default = true;
else that.addressList[i].is_default = false;
}
that.$util.Tips({
title: that.$t(`设置成功`),
icon: 'success'
}, function() {
that.$set(that, 'addressList', that.addressList);
});
}).catch(err => {
return that.$util.Tips({
title: err
});
});
},
/**
* 编辑地址
*/
editAddress: function(id) {
let cartId = this.cartId,
pinkId = this.pinkId,
couponId = this.couponId;
this.cartId = '';
this.pinkId = '';
this.couponId = '';
uni.navigateTo({
url: '/pages/users/user_address/index?id=' + id + '&cartId=' + cartId + '&pinkId=' +
pinkId + '&couponId=' +
couponId + '&new=' + this.news
})
},
/**
* 删除地址
*/
delAddress: function(index) {
let that = this,
address = this.addressList[index];
if (address == undefined) return that.$util.Tips({
title: that.$t(`您删除的地址不存在!`)
});
delAddress(address.id).then(res => {
that.$util.Tips({
title: that.$t(`删除成功`),
icon: 'success'
}, function() {
that.addressList.splice(index, 1);
that.$set(that, 'addressList', that.addressList);
});
}).catch(err => {
return that.$util.Tips({
title: err
});
});
},
/**
* 新增地址
*/
addAddress: function() {
let cartId = this.cartId,
pinkId = this.pinkId,
couponId = this.couponId;
this.cartId = '';
this.pinkId = '';
this.couponId = '';
uni.navigateTo({
url: '/pages/users/user_address/index?cartId=' + cartId + '&pinkId=' + pinkId +
'&couponId=' + couponId + '&new=' + this.news
})
},
goOrder: function(id) {
let cartId = '';
let pinkId = '';
let couponId = '';
if (this.cartId && id) {
cartId = this.cartId;
pinkId = this.pinkId;
couponId = this.couponId;
this.cartId = '';
this.pinkId = '';
this.couponId = '';
uni.redirectTo({
url: '/pages/goods/order_confirm/index?is_address=1&new=' + this.news + '&cartId=' +
cartId + '&addressId=' + id + '&pinkId=' +
pinkId + '&couponId=' + couponId + '&noCoupon=' + this.noCoupon
})
}
}
},
onReachBottom: function() {
this.getAddressList();
}
}
</script>
<style>
.address-management.fff {
background-color: #fff;
height: 1300rpx
}
.address-management .line {
width: 100%;
height: 3rpx;
}
.address-management .line image {
width: 100%;
height: 100%;
display: block;
}
.address-management .item {
background-color: #fff;
padding: 0 30rpx;
margin-bottom: 12rpx;
}
.address-management .item .address {
padding: 30rpx 0;
border-bottom: 1rpx solid #eee;
font-size: 28rpx;
color: #282828;
}
.address-management .item .address .consignee {
font-size: 28rpx;
font-weight: bold;
margin-bottom: 8rpx;
}
.address-management .item .address .consignee .phone {
margin-left: 25rpx;
}
.address-management .item .operation {
height: 83rpx;
font-size: 28rpx;
color: #282828;
}
.address-management .item .operation .radio text {
margin-left: 13rpx;
}
.address-management .item .operation .iconfont {
color: #2c2c2c;
font-size: 35rpx;
vertical-align: -2rpx;
margin-right: 10rpx;
}
.address-management .item .operation .iconfont.icon-shanchu {
margin-left: 40rpx;
font-size: 38rpx;
}
.address-management .footer {
position: fixed;
width: 100%;
background-color: #fff;
bottom: 0;
height: 106rpx;
padding: 0 30rpx;
box-sizing: border-box;
}
.address-management .footer .addressBnt {
width: 330rpx;
height: 76rpx;
border-radius: 50rpx;
text-align: center;
line-height: 76rpx;
font-size: 30rpx;
color: #fff;
background-color: var(--view-theme);
}
.address-management .footer .addressBnt.on {
width: 690rpx;
margin: 0 auto;
}
.address-management .footer .addressBnt .iconfont {
font-size: 35rpx;
margin-right: 8rpx;
vertical-align: -1rpx;
}
.address-management .footer .addressBnt.wxbnt {
background-color: #FE960F;
}
editAddress({
address: addressP,
is_default: 1,
real_name: res.userName,
post_code: res.postalCode,
phone: res.telNumber,
detail: res.detailInfo,
id: 0,
type: 1
}).then(res => {
that.$util.Tips({
title: that.$t(`添加成功`),
icon: 'success'
}, function() {
that.getAddressList(true);
});
}).catch(err => {
return that.$util.Tips({
title: err
});
});
},
fail: function(err) {
console.log(err)
if (err.errMsg == 'chooseAddress:cancel') return that.$util
.Tips({
title: that.$t(`取消选择`)
});
},
})
},
fail: function(res) {
uni.showModal({
title: that.$t(`您已拒绝导入微信地址权限`),
content: that.$t(`是否进入权限管理,调整授权?`),
success(res) {
if (res.confirm) {
uni.openSetting({
success: function(res) {}
});
} else if (res.cancel) {
return that.$util.Tips({
title: that.$t(`已取消!`)
});
}
}
})
}
})
},
/*
* 导入微信地址(公众号)
*/
getAddress() {
let that = this;
that.$wechat.openAddress().then(userInfo => {
// open();
editAddress({
real_name: userInfo.userName,
phone: userInfo.telNumber,
address: {
province: userInfo.provinceName,
city: userInfo.cityName,
district: userInfo.countryName
},
detail: userInfo.detailInfo,
post_code: userInfo.postalCode,
is_default: 1,
type: 1
})
.then(() => {
that.$util.Tips({
title: that.$t(`添加成功`),
icon: 'success'
}, function() {
// close();
that.getAddressList(true);
});
})
.catch(err => {
// close();
return that.$util.Tips({
title: err || that.$t(`添加失败`)
});
});
});
},
/**
* 获取地址列表
*
*/
getAddressList: function(isPage) {
let that = this;
if (isPage) {
that.loadend = false;
that.page = 1;
that.$set(that, 'addressList', []);
};
if (that.loading) return;
if (that.loadend) return;
that.loading = true;
that.loadTitle = '';
getAddressList({
page: that.page,
limit: that.limit
}).then(res => {
let list = res.data;
let loadend = list.length < that.limit;
that.addressList = that.$util.SplitArray(list, that.addressList);
that.$set(that, 'addressList', that.addressList);
that.loadend = loadend;
that.loadTitle = loadend ? that.$t(`我也是有底线的`) : that.$t(`加载更多`);
that.page = that.page + 1;
that.loading = false;
}).catch(err => {
that.loading = false;
that.loadTitle = that.$t(`加载更多`);
});
},
/**
* 设置默认地址
*/
radioChange: function(e) {
let index = parseInt(e.detail.value),
that = this;
let address = this.addressList[index];
if (address == undefined) return that.$util.Tips({
title: that.$t(`您设置的默认地址不存在!`)
});
setAddressDefault(address.id).then(res => {
for (let i = 0, len = that.addressList.length; i < len; i++) {
if (i == index) that.addressList[i].is_default = true;
else that.addressList[i].is_default = false;
}
that.$util.Tips({
title: that.$t(`设置成功`),
icon: 'success'
}, function() {
that.$set(that, 'addressList', that.addressList);
});
}).catch(err => {
return that.$util.Tips({
title: err
});
});
},
/**
* 编辑地址
*/
editAddress: function(id) {
let cartId = this.cartId,
pinkId = this.pinkId,
couponId = this.couponId;
this.cartId = '';
this.pinkId = '';
this.couponId = '';
uni.navigateTo({
url: '/pages/users/user_address/index?id=' + id + '&cartId=' + cartId + '&pinkId=' +
pinkId + '&couponId=' +
couponId + '&new=' + this.news
})
},
/**
* 删除地址
*/
delAddress: function(index) {
let that = this,
address = this.addressList[index];
if (address == undefined) return that.$util.Tips({
title: that.$t(`您删除的地址不存在!`)
});
delAddress(address.id).then(res => {
that.$util.Tips({
title: that.$t(`删除成功`),
icon: 'success'
}, function() {
that.addressList.splice(index, 1);
that.$set(that, 'addressList', that.addressList);
});
}).catch(err => {
return that.$util.Tips({
title: err
});
});
},
/**
* 新增地址
*/
addAddress: function() {
let cartId = this.cartId,
pinkId = this.pinkId,
couponId = this.couponId;
this.cartId = '';
this.pinkId = '';
this.couponId = '';
uni.navigateTo({
url: '/pages/users/user_address/index?cartId=' + cartId + '&pinkId=' + pinkId +
'&couponId=' + couponId + '&new=' + this.news
})
},
goOrder: function(id) {
let cartId = '';
let pinkId = '';
let couponId = '';
if (this.cartId && id) {
cartId = this.cartId;
pinkId = this.pinkId;
couponId = this.couponId;
this.cartId = '';
this.pinkId = '';
this.couponId = '';
uni.redirectTo({
url: '/pages/goods/order_confirm/index?is_address=1&new=' + this.news + '&cartId=' +
cartId + '&addressId=' + id + '&pinkId=' +
pinkId + '&couponId=' + couponId + '&noCoupon=' + this.noCoupon
})
}
}
},
onReachBottom: function() {
this.getAddressList();
}
}
</script>
<style>
.address-management.fff {
background-color: #fff;
height: 1300rpx
}
.address-management .line {
width: 100%;
height: 3rpx;
}
.address-management .line image {
width: 100%;
height: 100%;
display: block;
}
.address-management .item {
background-color: #fff;
padding: 0 30rpx;
margin-bottom: 12rpx;
}
.address-management .item .address {
padding: 30rpx 0;
border-bottom: 1rpx solid #eee;
font-size: 28rpx;
color: #282828;
}
.address-management .item .address .consignee {
font-size: 28rpx;
font-weight: bold;
margin-bottom: 8rpx;
}
.address-management .item .address .consignee .phone {
margin-left: 25rpx;
}
.address-management .item .operation {
height: 83rpx;
font-size: 28rpx;
color: #282828;
}
.address-management .item .operation .radio text {
margin-left: 13rpx;
}
.address-management .item .operation .iconfont {
color: #2c2c2c;
font-size: 35rpx;
vertical-align: -2rpx;
margin-right: 10rpx;
}
.address-management .item .operation .iconfont.icon-shanchu {
margin-left: 40rpx;
font-size: 38rpx;
}
.address-management .footer {
position: fixed;
width: 100%;
background-color: #fff;
bottom: 0;
height: 106rpx;
padding: 0 30rpx;
box-sizing: border-box;
}
.address-management .footer .addressBnt {
width: 330rpx;
height: 76rpx;
border-radius: 50rpx;
text-align: center;
line-height: 76rpx;
font-size: 30rpx;
color: #fff;
background-color: var(--view-theme);
}
.address-management .footer .addressBnt.on {
width: 690rpx;
margin: 0 auto;
}
.address-management .footer .addressBnt .iconfont {
font-size: 35rpx;
margin-right: 8rpx;
vertical-align: -1rpx;
}
.address-management .footer .addressBnt.wxbnt {
background-color: #FE960F;
}
</style>

View File

@ -43,7 +43,7 @@
</view>
<view class='item acea-row row-between-wrapper'>
<view>{{$t(`昵称`)}}</view>
<view class='input'><input type='nickname' name='nickname' :value='userInfo.nickname'></input>
<view class='input'><input type='nickname' name='nickname' :maxlength="16" :value='userInfo.nickname'></input>
</view>
</view>
<view class='item acea-row row-between-wrapper'>
@ -254,12 +254,15 @@
},
bindPickerChange(e, item) {
this.setIndex = e.detail.value
uni.setStorageSync('locale', this.array[this.setIndex].value);
Cache.set('locale', this.array[this.setIndex].value)
getLangJson().then(res => {
Cache.set('localeJson', res.data, 600)
this.$i18n.locale = this.array[this.setIndex].value;
this.$i18n.setLocaleMessage(this.array[this.setIndex].value, res.data[this
.array[this.setIndex].value]);
uni.setStorageSync('localeJson', res.data);
this.$i18n.setLocaleMessage(this.array[this.setIndex].value, res.data[this.array[
this.setIndex].value]);
this.$nextTick(e => {
this.$i18n.locale = this.array[this.setIndex].value;
})
Cache.set('localeSet', true, 600)
})
},
@ -463,7 +466,6 @@
const {
avatarUrl
} = e.detail
console.log(avatarUrl)
this.$util.uploadImgs('upload/image', avatarUrl, (res) => {
this.userInfo.avatar = res.data.url
}, (err) => {
@ -611,7 +613,7 @@
padding: 30rpx 30rpx 30rpx 0;
border-bottom: 1rpx solid #f2f2f2;
margin-left: 30rpx;
font-size: 32rpx;
font-size: 28rpx;
color: #282828;
}
@ -636,17 +638,20 @@
}
.personal-data .list .item .input {
width: 415rpx;
max-width: 400rpx;
text-align: right;
color: #868686;
color: #868686;
.icon-suozi{
margin-left: 10rpx;
}
}
.personal-data .list .item .input .id {
width: 365rpx;
// width: 180rpx;
}
.personal-data .list .item .input .iconfont {
font-size: 35rpx;
font-size: 24rpx;
}
.personal-data .modifyBnt {

View File

@ -1,453 +1,457 @@
<template>
<view :style="colorStyle">
<view class='my-account'>
<view class='wrapper'>
<view class='header'>
<view class='headerCon'>
<view class='account acea-row row-top row-between'>
<view class='assets'>
<view>{{$t(`总资产(元)`)}}</view>
<view class='money'>{{userInfo.now_money || 0}}</view>
</view>
<!-- #ifdef APP-PLUS || H5 -->
<navigator url="/pages/users/user_payment/index" hover-class="none"
class='recharge'>{{$t(`充值`)}}</navigator>
<!-- #endif -->
<!-- #ifdef MP -->
<view v-if="recharge_switch" @click="openSubscribe('/pages/users/user_payment/index')"
class='recharge'>{{$t(`充值`)}}</view>
<!-- #endif -->
</view>
<view class='cumulative acea-row row-top'>
<!-- #ifdef APP-PLUS || H5 -->
<view class='item'>
<view>{{$t(`累计充值(元)`)}}</view>
<view class='money'>{{userInfo.recharge || 0}}</view>
</view>
<!-- #endif -->
<!-- #ifdef MP -->
<view class='item' v-if="recharge_switch">
<view>{{$t(`累计充值(元)`)}}</view>
<view class='money'>{{userInfo.recharge || 0}}</view>
</view>
<!-- #endif -->
<view class='item'>
<view>{{$t(`累计消费(元)`)}}</view>
<view class='money'>{{userInfo.orderStatusSum || 0}}</view>
</view>
</view>
</view>
</view>
<view class='nav acea-row row-middle'>
<navigator class='item' hover-class='none' url='/pages/users/user_bill/index'>
<view class='iconfont icon-s-zhangdanjilu'></view>
<view>{{$t(`账单记录`)}}</view>
</navigator>
<navigator class='item' hover-class='none' url='/pages/users/user_bill/index?type=1'>
<view class='iconfont icon-s-xiaofeijilu'></view>
<view>{{$t(`消费记录`)}}</view>
</navigator>
<navigator class='item' hover-class='none' url='/pages/users/user_bill/index?type=2' v-if="recharge_switch">
<view class='iconfont icon-s-chongzhijilu'></view>
<view>{{$t(`充值记录`)}}</view>
</navigator>
<navigator class='item' hover-class='none' url='/pages/users/user_integral/index'>
<view class='iconfont icon-jifenzhongxin'></view>
<view>{{$t(`积分中心`)}}</view>
</navigator>
</view>
<view class='advert acea-row row-between-wrapper'>
<navigator class='item acea-row row-between-wrapper' hover-class='none'
url='/pages/users/user_sgin/index'>
<view class='text'>
<view class='name'>{{$t(`签到领积分`)}}</view>
<view>{{$t(`赚积分抵现金`)}}</view>
</view>
<view class='pictrue'>
<image src='../static/gift.png'></image>
</view>
</navigator>
<navigator class='item on acea-row row-between-wrapper' hover-class='none'
url='/pages/users/user_get_coupon/index'>
<view class='text'>
<view class='name'>{{$t(`领取优惠券`)}}</view>
<view>{{$t(`满减享优惠`)}}</view>
</view>
<view class='pictrue'>
<image src='../static/money.png'></image>
</view>
</navigator>
</view>
<view class='list'>
<view class='item acea-row row-between-wrapper'>
<view class='picTxt acea-row row-between-wrapper'>
<view class='iconfont icon-hebingxingzhuang'></view>
<view class='text'>
<view class='line1'>{{$t(`最新拼团活动`)}}</view>
<view class='infor line1'>{{$t(`最新的优惠商品上架拼团`)}}</view>
</view>
</view>
<navigator hover-class='none' url='/pages/activity/goods_combination/index' class='bnt'
v-if="activity.is_pink">{{$t(`立即参与`)}}</navigator>
<view class='bnt end' v-else>{{$t(`已结束`)}}</view>
</view>
<view class='item acea-row row-between-wrapper'>
<view class='picTxt acea-row row-between-wrapper'>
<view class='iconfont icon-miaosha yellow'></view>
<view class='text'>
<view class='line1'>{{$t(`当前限时秒杀`)}}</view>
<view class='infor line1'>{{$t(`最新商品秒杀进行中`)}}</view>
</view>
</view>
<navigator hover-class='none' url='/pages/activity/goods_seckill/index' class='bnt'
v-if="activity.is_seckill">{{$t(`立即参与`)}}</navigator>
<view class='bnt end' v-else>{{$t(`已结束`)}}</view>
</view>
<view class='item acea-row row-between-wrapper'>
<view class='picTxt acea-row row-between-wrapper'>
<view class='iconfont icon-kanjia1 green'></view>
<view class='text'>
<view class='line1'>{{$t(`砍价活动`)}}</view>
<view class='infor line1'>{{$t(`呼朋唤友来砍价`)}}</view>
</view>
</view>
<navigator hover-class='none' url='/pages/activity/goods_bargain/index' class='bnt'
v-if="activity.is_bargin">{{$t(`立即参与`)}}</navigator>
<view class='bnt end' v-else>{{$t(`已结束`)}}</view>
</view>
</view>
</view>
<recommend :hostProduct="hostProduct"></recommend>
</view>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
<!-- #ifndef MP -->
<home></home>
<!-- #endif -->
</view>
</template>
<script>
import {
getProductHot
} from '@/api/store.js';
import {
openRechargeSubscribe
} from '@/utils/SubscribeMessage.js';
import {
getUserInfo,
userActivity
} from '@/api/user.js';
import {
toLogin
} from '@/libs/login.js';
import {
mapGetters
} from "vuex";
import recommend from '@/components/recommend/index';
// #ifdef MP
import authorize from '@/components/Authorize';
// #endif
import home from '@/components/home';
import colors from "@/mixins/color";
export default {
components: {
recommend,
// #ifdef MP
authorize,
// #endif
home
},
mixins: [colors],
data() {
return {
userInfo: {},
hostProduct: [],
isClose: false,
recharge_switch: 0,
activity: {},
isAuto: false, //没有授权的不会自动授权
isShowAuth: false, //是否隐藏授权
hotScroll: false,
hotPage: 1,
hotLimit: 10
};
},
computed: mapGetters(['isLogin']),
watch: {
isLogin: {
handler: function(newV, oldV) {
if (newV) {
this.getUserInfo();
this.get_host_product();
this.get_activity();
}
},
deep: true
}
},
onLoad() {
if (this.isLogin) {
this.getUserInfo();
this.get_host_product();
this.get_activity();
} else {
toLogin();
}
},
methods: {
onLoadFun: function() {
this.getUserInfo();
this.get_host_product();
this.get_activity();
},
// 授权关闭
authColse: function(e) {
this.isShowAuth = e
},
// #ifdef MP
openSubscribe: function(page) {
uni.showLoading({
title: this.$t(`正在加载`),
})
openRechargeSubscribe().then(res => {
uni.hideLoading();
uni.navigateTo({
url: page,
});
}).catch(() => {
uni.hideLoading();
});
},
// #endif
/**
* 获取用户详情
*/
getUserInfo: function() {
let that = this;
getUserInfo().then(res => {
that.$set(that, 'userInfo', res.data);
that.recharge_switch = res.data.recharge_switch;
});
},
/**
* 获取活动可参与否
*/
get_activity: function() {
let that = this;
userActivity().then(res => {
that.$set(that, "activity", res.data);
})
},
/**
* 获取我的推荐
*/
get_host_product: function() {
let that = this;
if (that.hotScroll) return
getProductHot(
that.hotPage,
that.hotLimit,
).then(res => {
that.hotPage++
that.hotScroll = res.data.length < that.hotLimit
that.hostProduct = that.hostProduct.concat(res.data)
});
}
},
onReachBottom() {
this.get_host_product();
}
}
</script>
<style scoped lang="scss">
.my-account .wrapper {
background-color: #fff;
padding: 32rpx 0 34rpx 0;
margin-bottom: 14rpx;
}
.my-account .wrapper .header {
width: 690rpx;
height: 330rpx;
// background-image: linear-gradient(to right, #f33b2b 0%, #f36053 100%);
// background-image: var(--view-theme);
background: var(--view-theme);
border-radius: 16rpx;
margin: 0 auto;
box-sizing: border-box;
color: rgba(255, 255, 255, 0.6);
font-size: 24rpx;
}
.my-account .wrapper .header .headerCon {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAArIAAAFKCAYAAADhULxpAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQyIDc5LjE2MDkyNCwgMjAxNy8wNy8xMy0wMTowNjozOSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTggKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOkEzMUM4RDlEM0YxNTExRTk4OUJFQ0Q4Qjg0RDBCMzQ1IiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOkEzMUM4RDlFM0YxNTExRTk4OUJFQ0Q4Qjg0RDBCMzQ1Ij4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6QTMxQzhEOUIzRjE1MTFFOTg5QkVDRDhCODREMEIzNDUiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6QTMxQzhEOUMzRjE1MTFFOTg5QkVDRDhCODREMEIzNDUiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6ymvxvAAAIhklEQVR42uzd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');
background-repeat: no-repeat;
background-size: 100%;
height: 100%;
width: 100%;
padding: 36rpx 0 29rpx 0;
box-sizing: border-box;
}
.my-account .wrapper .header .headerCon .account {
padding: 0 35rpx;
}
.my-account .wrapper .header .headerCon .account .assets .money {
font-size: 72rpx;
color: #fff;
font-family: 'Guildford Pro';
}
.my-account .wrapper .header .headerCon .account .recharge {
font-size: 28rpx;
width: 150rpx;
height: 54rpx;
border-radius: 27rpx;
background-color: #fff9f8;
text-align: center;
line-height: 54rpx;
color: var(--view-theme);
}
.my-account .wrapper .header .headerCon .cumulative {
margin-top: 46rpx;
}
.my-account .wrapper .header .headerCon .cumulative .item {
flex: 1;
padding-left: 35rpx;
}
.my-account .wrapper .header .headerCon .cumulative .item .money {
font-size: 48rpx;
font-family: 'Guildford Pro';
color: #fff;
margin-top: 6rpx;
}
.my-account .wrapper .nav {
height: 155rpx;
border-bottom: 1rpx solid #f5f5f5;
}
.my-account .wrapper .nav .item {
flex: 1;
text-align: center;
font-size: 26rpx;
color: #999;
}
.my-account .wrapper .nav .item .iconfont {
font-size: 44rpx;
margin: 0 auto;
margin-bottom: 14rpx;
color: var(--view-theme);
}
.my-account .wrapper .advert {
padding: 0 30rpx;
margin-top: 30rpx;
}
.my-account .wrapper .advert .item {
background-color: #fff6d1;
width: 332rpx;
height: 118rpx;
border-radius: 10rpx;
padding: 0 27rpx 0 25rpx;
box-sizing: border-box;
font-size: 24rpx;
color: #e44609;
}
.my-account .wrapper .advert .item.on {
background-color: #fff3f3;
color: #e96868;
}
.my-account .wrapper .advert .item .pictrue {
width: 78rpx;
height: 78rpx;
}
.my-account .wrapper .advert .item .pictrue image {
width: 100%;
height: 100%;
}
.my-account .wrapper .advert .item .text .name {
font-size: 30rpx;
font-weight: bold;
color: #f33c2b;
margin-bottom: 7rpx;
}
.my-account .wrapper .advert .item.on .text .name {
color: #f64051;
}
.my-account .wrapper .list {
padding: 0 30rpx;
}
.my-account .wrapper .list .item {
margin-top: 44rpx;
}
.my-account .wrapper .list .item .picTxt .iconfont {
width: 82rpx;
height: 82rpx;
border-radius: 50%;
background-image: linear-gradient(to right, #ff9389 0%, #f9776b 100%);
text-align: center;
line-height: 82rpx;
color: #fff;
font-size: 40rpx;
}
.my-account .wrapper .list .item .picTxt .iconfont.yellow {
background-image: linear-gradient(to right, #ffccaa 0%, #fea060 100%);
}
.my-account .wrapper .list .item .picTxt .iconfont.green {
background-image: linear-gradient(to right, #a1d67c 0%, #9dd074 100%);
}
.my-account .wrapper .list .item .picTxt {
width: 428rpx;
font-size: 30rpx;
color: #282828;
}
.my-account .wrapper .list .item .picTxt .text {
width: 317rpx;
}
.my-account .wrapper .list .item .picTxt .text .infor {
font-size: 24rpx;
color: #999;
margin-top: 5rpx;
}
.my-account .wrapper .list .item .bnt {
font-size: 26rpx;
color: #282828;
width: 156rpx;
height: 52rpx;
border: 1rpx solid #ddd;
border-radius: 26rpx;
text-align: center;
line-height: 52rpx;
}
.my-account .wrapper .list .item .bnt.end {
font-size: 26rpx;
color: #aaa;
background-color: #f2f2f2;
border-color: #f2f2f2;
}
<template>
<view :style="colorStyle">
<view class='my-account'>
<view class='wrapper'>
<view class='header'>
<view class='headerCon'>
<view class='account acea-row row-top row-between'>
<view class='assets'>
<view>{{$t(`总资产(元)`)}}</view>
<view class='money'>{{userInfo.now_money || 0}}</view>
</view>
<!-- #ifdef APP-PLUS || H5 -->
<navigator url="/pages/users/user_payment/index" hover-class="none" class='recharge'>
{{$t(`充值`)}}
</navigator>
<!-- #endif -->
<!-- #ifdef MP -->
<view v-if="recharge_switch" @click="openSubscribe('/pages/users/user_payment/index')"
class='recharge'>{{$t(`充值`)}}</view>
<!-- #endif -->
</view>
<view class='cumulative acea-row row-top'>
<!-- #ifdef APP-PLUS || H5 -->
<view class='item'>
<view>{{$t(`累计充值(元)`)}}</view>
<view class='money'>{{userInfo.recharge || 0}}</view>
</view>
<!-- #endif -->
<!-- #ifdef MP -->
<view class='item' v-if="recharge_switch">
<view>{{$t(`累计充值(元)`)}}</view>
<view class='money'>{{userInfo.recharge || 0}}</view>
</view>
<!-- #endif -->
<view class='item'>
<view>{{$t(`累计消费(元)`)}}</view>
<view class='money'>{{userInfo.orderStatusSum || 0}}</view>
</view>
</view>
</view>
</view>
<view class='nav acea-row row-middle'>
<navigator class='item' hover-class='none' url='/pages/users/user_bill/index'>
<view class='iconfont icon-s-zhangdanjilu'></view>
<view>{{$t(`账单记录`)}}</view>
</navigator>
<navigator class='item' hover-class='none' url='/pages/users/user_bill/index?type=1'>
<view class='iconfont icon-s-xiaofeijilu'></view>
<view>{{$t(`消费记录`)}}</view>
</navigator>
<navigator class='item' hover-class='none' url='/pages/users/user_bill/index?type=2'
v-if="recharge_switch">
<view class='iconfont icon-s-chongzhijilu'></view>
<view>{{$t(`充值记录`)}}</view>
</navigator>
<navigator class='item' hover-class='none' url='/pages/users/user_integral/index'>
<view class='iconfont icon-jifenzhongxin'></view>
<view>{{$t(`积分中心`)}}</view>
</navigator>
</view>
<view class='advert acea-row row-between-wrapper'>
<navigator class='item acea-row row-between-wrapper' hover-class='none'
url='/pages/users/user_sgin/index'>
<view class='text'>
<view class='name'>{{$t(`签到领积分`)}}</view>
<view>{{$t(`赚积分抵现金`)}}</view>
</view>
<view class='pictrue'>
<image src='../static/gift.png'></image>
</view>
</navigator>
<navigator class='item on acea-row row-between-wrapper' hover-class='none'
url='/pages/users/user_get_coupon/index'>
<view class='text'>
<view class='name'>{{$t(`领取优惠券`)}}</view>
<view>{{$t(`满减享优惠`)}}</view>
</view>
<view class='pictrue'>
<image src='../static/money.png'></image>
</view>
</navigator>
</view>
<view class='list'>
<view class='item acea-row row-between-wrapper'>
<view class='picTxt acea-row row-between-wrapper'>
<view class='iconfont icon-hebingxingzhuang'></view>
<view class='text'>
<view class='line1'>{{$t(`最新拼团活动`)}}</view>
<view class='infor line1'>{{$t(`最新的优惠商品上架拼团`)}}</view>
</view>
</view>
<navigator hover-class='none' url='/pages/activity/goods_combination/index' class='bnt'
v-if="activity.is_pink">{{$t(`立即参与`)}}</navigator>
<view class='bnt end' v-else>{{$t(`已结束`)}}</view>
</view>
<view class='item acea-row row-between-wrapper'>
<view class='picTxt acea-row row-between-wrapper'>
<view class='iconfont icon-miaosha yellow'></view>
<view class='text'>
<view class='line1'>{{$t(`当前限时秒杀`)}}</view>
<view class='infor line1'>{{$t(`最新商品秒杀进行中`)}}</view>
</view>
</view>
<navigator hover-class='none' url='/pages/activity/goods_seckill/index' class='bnt'
v-if="activity.is_seckill">{{$t(`立即参与`)}}</navigator>
<view class='bnt end' v-else>{{$t(`已结束`)}}</view>
</view>
<view class='item acea-row row-between-wrapper'>
<view class='picTxt acea-row row-between-wrapper'>
<view class='iconfont icon-kanjia1 green'></view>
<view class='text'>
<view class='line1'>{{$t(`砍价活动`)}}</view>
<view class='infor line1'>{{$t(`呼朋唤友来砍价`)}}</view>
</view>
</view>
<navigator hover-class='none' url='/pages/activity/goods_bargain/index' class='bnt'
v-if="activity.is_bargin">{{$t(`立即参与`)}}</navigator>
<view class='bnt end' v-else>{{$t(`已结束`)}}</view>
</view>
</view>
</view>
<recommend :hostProduct="hostProduct"></recommend>
</view>
<!-- #ifdef MP -->
<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
<!-- #endif -->
<!-- #ifndef MP -->
<home></home>
<!-- #endif -->
</view>
</template>
<script>
import {
getProductHot
} from '@/api/store.js';
import {
openRechargeSubscribe
} from '@/utils/SubscribeMessage.js';
import {
getUserInfo,
userActivity
} from '@/api/user.js';
import {
toLogin
} from '@/libs/login.js';
import {
mapGetters
} from "vuex";
import recommend from '@/components/recommend/index';
// #ifdef MP
import authorize from '@/components/Authorize';
// #endif
import home from '@/components/home';
import colors from "@/mixins/color";
export default {
components: {
recommend,
// #ifdef MP
authorize,
// #endif
home
},
mixins: [colors],
data() {
return {
userInfo: {},
hostProduct: [],
isClose: false,
recharge_switch: 0,
activity: {},
isAuto: false, //没有授权的不会自动授权
isShowAuth: false, //是否隐藏授权
hotScroll: false,
hotPage: 1,
hotLimit: 10
};
},
computed: mapGetters(['isLogin']),
watch: {
isLogin: {
handler: function(newV, oldV) {
if (newV) {
this.getUserInfo();
this.get_host_product();
this.get_activity();
}
},
deep: true
}
},
onLoad() {
if (this.isLogin) {
this.getUserInfo();
this.get_host_product();
this.get_activity();
} else {
toLogin();
}
},
methods: {
onLoadFun: function() {
this.getUserInfo();
this.get_host_product();
this.get_activity();
},
// 授权关闭
authColse: function(e) {
this.isShowAuth = e
},
// #ifdef MP
openSubscribe: function(page) {
uni.showLoading({
title: this.$t(`正在加载`),
})
openRechargeSubscribe().then(res => {
uni.hideLoading();
uni.navigateTo({
url: page,
});
}).catch(() => {
uni.hideLoading();
});
},
// #endif
/**
* 获取用户详情
*/
getUserInfo: function() {
let that = this;
getUserInfo().then(res => {
that.$set(that, 'userInfo', res.data);
that.recharge_switch = res.data.recharge_switch;
});
},
/**
* 获取活动可参与否
*/
get_activity: function() {
let that = this;
userActivity().then(res => {
that.$set(that, "activity", res.data);
})
},
/**
* 获取我的推荐
*/
get_host_product: function() {
let that = this;
if (that.hotScroll) return
getProductHot(
that.hotPage,
that.hotLimit,
).then(res => {
that.hotPage++
that.hotScroll = res.data.length < that.hotLimit
that.hostProduct = that.hostProduct.concat(res.data)
});
}
},
onReachBottom() {
this.get_host_product();
}
}
</script>
<style scoped lang="scss">
.my-account .wrapper {
background-color: #fff;
padding: 32rpx 0 34rpx 0;
margin-bottom: 14rpx;
}
.my-account .wrapper .header {
width: 690rpx;
height: 330rpx;
// background-image: linear-gradient(to right, #f33b2b 0%, #f36053 100%);
// background-image: var(--view-theme);
background: var(--view-theme);
border-radius: 16rpx;
margin: 0 auto;
box-sizing: border-box;
color: rgba(255, 255, 255, 0.6);
font-size: 24rpx;
}
.my-account .wrapper .header .headerCon {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAArIAAAFKCAYAAADhULxpAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQyIDc5LjE2MDkyNCwgMjAxNy8wNy8xMy0wMTowNjozOSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTggKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOkEzMUM4RDlEM0YxNTExRTk4OUJFQ0Q4Qjg0RDBCMzQ1IiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOkEzMUM4RDlFM0YxNTExRTk4OUJFQ0Q4Qjg0RDBCMzQ1Ij4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6QTMxQzhEOUIzRjE1MTFFOTg5QkVDRDhCODREMEIzNDUiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6QTMxQzhEOUMzRjE1MTFFOTg5QkVDRDhCODREMEIzNDUiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6ymvxvAAAIhklEQVR42uzd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');
background-repeat: no-repeat;
background-size: 100%;
height: 100%;
width: 100%;
padding: 36rpx 0 29rpx 0;
box-sizing: border-box;
}
.my-account .wrapper .header .headerCon .account {
padding: 0 35rpx;
}
.my-account .wrapper .header .headerCon .account .assets .money {
font-size: 72rpx;
color: #fff;
margin-top: 6rpx;
font-family: 'Guildford Pro';
}
.my-account .wrapper .header .headerCon .account .recharge {
font-size: 28rpx;
width: 150rpx;
height: 54rpx;
border-radius: 27rpx;
background-color: #fff9f8;
text-align: center;
line-height: 54rpx;
color: var(--view-theme);
}
.my-account .wrapper .header .headerCon .cumulative {
margin-top: 46rpx;
}
.my-account .wrapper .header .headerCon .cumulative .item {
flex: 1;
padding-left: 35rpx;
}
.my-account .wrapper .header .headerCon .cumulative .item .money {
font-size: 48rpx;
font-family: 'Guildford Pro';
color: #fff;
margin-top: 6rpx;
}
.my-account .wrapper .nav {
height: 155rpx;
border-bottom: 1rpx solid #f5f5f5;
}
.my-account .wrapper .nav .item {
flex: 1;
text-align: center;
font-size: 26rpx;
color: #999;
}
.my-account .wrapper .nav .item .iconfont {
font-size: 44rpx;
margin: 0 auto;
margin-bottom: 14rpx;
color: var(--view-theme);
}
.my-account .wrapper .advert {
padding: 0 30rpx;
margin-top: 30rpx;
}
.my-account .wrapper .advert .item {
background-color: #fff6d1;
width: 332rpx;
height: 118rpx;
border-radius: 10rpx;
padding: 0 27rpx 0 25rpx;
box-sizing: border-box;
font-size: 24rpx;
color: #e44609;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1),
}
.my-account .wrapper .advert .item.on {
background-color: #fff3f3;
color: #e96868;
}
.my-account .wrapper .advert .item .pictrue {
width: 78rpx;
height: 78rpx;
}
.my-account .wrapper .advert .item .pictrue image {
width: 100%;
height: 100%;
}
.my-account .wrapper .advert .item .text .name {
font-size: 30rpx;
font-weight: bold;
color: #f33c2b;
margin-bottom: 7rpx;
}
.my-account .wrapper .advert .item.on .text .name {
color: #f64051;
}
.my-account .wrapper .list {
padding: 0 30rpx;
}
.my-account .wrapper .list .item {
margin-top: 44rpx;
}
.my-account .wrapper .list .item .picTxt .iconfont {
width: 82rpx;
height: 82rpx;
border-radius: 50%;
background-image: linear-gradient(to right, #ff9389 0%, #f9776b 100%);
text-align: center;
line-height: 82rpx;
color: #fff;
font-size: 40rpx;
}
.my-account .wrapper .list .item .picTxt .iconfont.yellow {
background-image: linear-gradient(to right, #ffccaa 0%, #fea060 100%);
}
.my-account .wrapper .list .item .picTxt .iconfont.green {
background-image: linear-gradient(to right, #a1d67c 0%, #9dd074 100%);
}
.my-account .wrapper .list .item .picTxt {
width: 428rpx;
font-size: 30rpx;
color: #282828;
}
.my-account .wrapper .list .item .picTxt .text {
width: 317rpx;
}
.my-account .wrapper .list .item .picTxt .text .infor {
font-size: 24rpx;
color: #999;
margin-top: 5rpx;
}
.my-account .wrapper .list .item .bnt {
font-size: 26rpx;
color: #282828;
width: 156rpx;
height: 52rpx;
border: 1rpx solid #ddd;
border-radius: 26rpx;
text-align: center;
line-height: 52rpx;
}
.my-account .wrapper .list .item .bnt.end {
font-size: 26rpx;
color: #aaa;
background-color: #f2f2f2;
border-color: #f2f2f2;
}
</style>

View File

@ -216,17 +216,28 @@
userLogin() {
Routine.getCode()
.then(code => {
uni.showLoading({
title: this.$t(`正在登录中`)
});
authLogin({
code,
spread_spid: app.globalData.spid,
spread_code: app.globalData.code
}).then(res => {
let time = res.data.expires_time - this.$Cache.time();
this.$store.commit('LOGIN', {
token: res.data.token,
time: time
});
this.getUserInfo()
if (res.data.key !== undefined && res.data.key) {
uni.hideLoading();
this.authKey = res.data.key;
this.isPhoneBox = true;
} else {
uni.hideLoading();
let time = res.data.expires_time - this.$Cache.time();
this.$store.commit('LOGIN', {
token: res.data.token,
time: time
});
this.getUserInfo()
}
})
})
.catch(err => {

View File

@ -1,97 +1,97 @@
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
import {
getUserInfo
} from "../../api/user.js";
import {
LOGIN_STATUS,
UID
} from '../../config/cache';
import Cache from '../../utils/cache';
import {
USER_INFO
} from '../../config/cache';
const state = {
token: Cache.get(LOGIN_STATUS) || false,
backgroundColor: "#fff",
userInfo: {},
uid: Cache.get(UID) || 0,
homeActive: false,
phoneStatus:true,
pageFooter:uni.getStorageSync('pageFoot') || {}
};
const mutations = {
SETPHONESTATUS(state,val){
state.phoneStatus = val;
},
LOGIN(state, opt) {
state.token = opt.token;
Cache.set(LOGIN_STATUS, opt.token, opt.time);
},
SETUID(state,val){
state.uid = val;
Cache.set(UID, val);
},
UPDATE_LOGIN(state, token) {
state.token = token;
},
LOGOUT(state) {
state.token = false;
state.uid = 0
Cache.clear(LOGIN_STATUS);
Cache.clear(UID);
},
BACKGROUND_COLOR(state, color) {
state.color = color;
document.body.style.backgroundColor = color;
},
UPDATE_USERINFO(state, userInfo) {
state.userInfo = userInfo;
Cache.set(USER_INFO, userInfo);
},
OPEN_HOME(state) {
state.homeActive = true;
},
CLOSE_HOME(state) {
state.homeActive = false;
},
FOOT_UPLOAD(state,data){
state.pageFooter = data
}
};
const actions = {
USERINFO({
state,
commit
}, force) {
if (state.userInfo !== null && !force)
return Promise.resolve(state.userInfo);
else
return new Promise(reslove => {
getUserInfo().then(res => {
commit("UPDATE_USERINFO", res.data);
Cache.set(USER_INFO, res.data);
reslove(res.data);
});
}).catch(() => {
});
}
};
export default {
state,
mutations,
actions
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
import {
getUserInfo
} from "../../api/user.js";
import {
LOGIN_STATUS,
UID,
USER_INFO
} from '../../config/cache';
import Cache from '../../utils/cache';
const state = {
token: Cache.get(LOGIN_STATUS) || false,
backgroundColor: "#fff",
userInfo: {},
uid: Cache.get(UID) || 0,
homeActive: false,
phoneStatus: true,
pageFooter: uni.getStorageSync('pageFoot') || {}
};
const mutations = {
SETPHONESTATUS(state, val) {
state.phoneStatus = val;
},
LOGIN(state, opt) {
state.token = opt.token;
Cache.set(LOGIN_STATUS, opt.token, opt.time);
},
SETUID(state, val) {
state.uid = val;
Cache.set(UID, val);
},
UPDATE_LOGIN(state, token) {
state.token = token;
},
LOGOUT(state) {
state.token = false;
state.uid = 0
Cache.clear(LOGIN_STATUS);
Cache.clear(USER_INFO);
Cache.clear(UID);
Cache.clear('snsapiCode');
},
BACKGROUND_COLOR(state, color) {
state.color = color;
document.body.style.backgroundColor = color;
},
UPDATE_USERINFO(state, userInfo) {
state.userInfo = userInfo;
Cache.set(USER_INFO, userInfo);
},
OPEN_HOME(state) {
state.homeActive = true;
},
CLOSE_HOME(state) {
state.homeActive = false;
},
FOOT_UPLOAD(state, data) {
state.pageFooter = data
}
};
const actions = {
USERINFO({
state,
commit
}, force) {
if (state.userInfo !== null && !force)
return Promise.resolve(state.userInfo);
else
return new Promise(reslove => {
getUserInfo().then(res => {
commit("UPDATE_USERINFO", res.data);
Cache.set(USER_INFO, res.data);
reslove(res.data);
});
}).catch(() => {
});
}
};
export default {
state,
mutations,
actions
};

View File

@ -1,168 +1,167 @@
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
import {
spread
} from "@/api/user";
import Cache from "@/utils/cache";
import {
getCustomerType
} from '@/api/api.js'
import {
getWorkermanUrl
} from '@/api/kefu.js'
/**
* 绑定用户授权
* @param {Object} puid
*/
export function silenceBindingSpread() {
//#ifdef H5
let puid = Cache.get('spread'),
code = 0;
//#endif
//#ifdef MP || APP-PLUS
let puid = getApp().globalData.spid,
code = getApp().globalData.code;
//#endif
puid = parseInt(puid);
if (Number.isNaN(puid)) {
puid = 0;
}
if (puid) {
spread({
puid,
code
}).then(res => {
//#ifdef H5
Cache.clear('spread');
//#endif
//#ifdef MP || APP-PLUS
getApp().globalData.spid = 0;
getApp().globalData.code = 0;
//#endif
}).catch(res => {});
}
}
export function isWeixin() {
return navigator.userAgent.toLowerCase().indexOf("micromessenger") !== -1;
}
export function getCustomer(url) {
getCustomerType().then(res => {
let type = res.data.customer_type
if (type == '0') {
uni.navigateTo({
url: url || '/pages/extension/customer_list/chat'
})
} else if (type == '1') {
uni.makePhoneCall({
phoneNumber: res.data.customer_phone //客服电话
});
} else {
// #ifdef APP-PLUS
plus.runtime.openURL(res.data.customer_url)
// #endif
// #ifdef H5 || MP
if (res.data.customer_url.indexOf('work.weixin.qq.com') > 0) {
// #ifdef H5
return window.location.href = res.data.customer_url
// #endif
// #ifdef MP
uni.openCustomerServiceChat({
extInfo: {
url: res.data.customer_url
},
corpId: res.data.customer_corpId,
success(res) {},
fail(err) {
uni.showToast({
title: err.errMsg,
icon: 'none',
duration: 2000
});
}
})
// #endif
} else {
uni.navigateTo({
url: `/pages/annex/web_view/index?url=${res.data.customer_url}`
});
}
// #endif
}
})
}
export function parseQuery() {
const res = {};
const query = (location.href.split("?")[1] || "")
.trim()
.replace(/^(\?|#|&)/, "");
if (!query) {
return res;
}
query.split("&").forEach(param => {
const parts = param.replace(/\+/g, " ").split("=");
const key = decodeURIComponent(parts.shift());
const val = parts.length > 0 ? decodeURIComponent(parts.join("=")) : null;
if (res[key] === undefined) {
res[key] = val;
} else if (Array.isArray(res[key])) {
res[key].push(val);
} else {
res[key] = [res[key], val];
}
});
return res;
}
export function updateURLParameter(url, param, paramVal) {
var newAdditionalURL = "";
var tempArray = url.split("?");
var baseURL = tempArray[0];
var additionalURL = tempArray[1];
var temp = "";
if (additionalURL) {
tempArray = additionalURL.split("&");
for (let i = 0; i < tempArray.length; i++) {
if (tempArray[i].split('=')[0] != param) {
newAdditionalURL += temp + tempArray[i];
temp = "&";
}
}
}
var rows_txt = temp + "" + param + "=" + paramVal;
return baseURL + "?" + newAdditionalURL + rows_txt;
}
let VUE_APP_WS_URL = Cache.get('WORKERMAN_URL') || ''
getWorkermanUrl().then(res => {
Cache.set('WORKERMAN_URL', res.data.chat)
VUE_APP_WS_URL = res.data.chat;
})
export {
VUE_APP_WS_URL
}
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
import {
spread
} from "@/api/user";
import Cache from "@/utils/cache";
import {
getCustomerType
} from '@/api/api.js'
import {
getWorkermanUrl
} from '@/api/kefu.js'
import store from '@/store';
/**
* 绑定用户授权
* @param {Object} puid
*/
export function silenceBindingSpread(app) {
console.log(app)
//#ifdef H5
let puid = Cache.get('spread'),
code = 0;
//#endif
//#ifdef MP || APP-PLUS
let puid = app.spid,
code = app.code;
//#endif
puid = parseInt(puid);
if (Number.isNaN(puid)) {
puid = 0;
}
if ((code || puid) && store.state.app.token) {
spread({
puid,
code
}).then(res => {
//#ifdef H5
Cache.clear('spread');
//#endif
//#ifdef MP || APP-PLUS
app.spid = 0;
app.code = 0;
//#endif
}).catch(res => {});
}
}
export function isWeixin() {
return navigator.userAgent.toLowerCase().indexOf("micromessenger") !== -1;
}
export function getCustomer(url) {
getCustomerType().then(res => {
let type = res.data.customer_type
if (type == '0') {
uni.navigateTo({
url: url || '/pages/extension/customer_list/chat'
})
} else if (type == '1') {
uni.makePhoneCall({
phoneNumber: res.data.customer_phone //客服电话
});
} else {
// #ifdef APP-PLUS
plus.runtime.openURL(res.data.customer_url)
// #endif
// #ifdef H5 || MP
if (res.data.customer_url.indexOf('work.weixin.qq.com') > 0) {
// #ifdef H5
return window.location.href = res.data.customer_url
// #endif
// #ifdef MP
uni.openCustomerServiceChat({
extInfo: {
url: res.data.customer_url
},
corpId: res.data.customer_corpId,
success(res) {},
fail(err) {
uni.showToast({
title: err.errMsg,
icon: 'none',
duration: 2000
});
}
})
// #endif
} else {
uni.navigateTo({
url: `/pages/annex/web_view/index?url=${res.data.customer_url}`
});
}
// #endif
}
})
}
export function parseQuery() {
const res = {};
const query = (location.href.split("?")[1] || "")
.trim()
.replace(/^(\?|#|&)/, "");
if (!query) {
return res;
}
query.split("&").forEach(param => {
const parts = param.replace(/\+/g, " ").split("=");
const key = decodeURIComponent(parts.shift());
const val = parts.length > 0 ? decodeURIComponent(parts.join("=")) : null;
if (res[key] === undefined) {
res[key] = val;
} else if (Array.isArray(res[key])) {
res[key].push(val);
} else {
res[key] = [res[key], val];
}
});
return res;
}
export function updateURLParameter(url, param, paramVal) {
var newAdditionalURL = "";
var tempArray = url.split("?");
var baseURL = tempArray[0];
var additionalURL = tempArray[1];
var temp = "";
if (additionalURL) {
tempArray = additionalURL.split("&");
for (let i = 0; i < tempArray.length; i++) {
if (tempArray[i].split('=')[0] != param) {
newAdditionalURL += temp + tempArray[i];
temp = "&";
}
}
}
var rows_txt = temp + "" + param + "=" + paramVal;
return baseURL + "?" + newAdditionalURL + rows_txt;
}
let VUE_APP_WS_URL = Cache.get('WORKERMAN_URL') || ''
getWorkermanUrl().then(res => {
Cache.set('WORKERMAN_URL', res.data.chat)
VUE_APP_WS_URL = res.data.chat;
})
export {
VUE_APP_WS_URL
}
export default parseQuery;

View File

@ -1,18 +1,19 @@
import Vue from 'vue';
import VueI18n from 'vue-i18n'
import Cache from '@/utils/cache';
Vue.use(VueI18n)
let lang = '';
// #ifdef MP || APP-PLUS
lang = uni.getStorageSync('locale') != '' ? uni.getStorageSync('locale') : 'zh-CN';
lang = Cache.has('locale') ? Cache.get('locale') : 'zh-CN';
// #endif
// #ifdef H5
lang = uni.getStorageSync('locale') != '' ? uni.getStorageSync('locale') : navigator.language;
lang = Cache.has('locale') ? Cache.get('locale') : navigator.language;
// #endif
const i18n = new VueI18n({
locale: lang ? lang : 'zh-CN',
locale: lang,
fallbackLocale: 'zh-CN',
messages: uni.getStorageSync('localeJson')
})
export default i18n