diff --git a/template/uni-app/App.vue b/template/uni-app/App.vue
index a194918d0..a22ea6483 100644
--- a/template/uni-app/App.vue
+++ b/template/uni-app/App.vue
@@ -29,6 +29,7 @@
mapGetters
} from "vuex"
import colors from '@/mixins/color.js';
+ import Cache from '@/utils/cache';
let green =
'--view-theme: rgba(66,202,77,1);--view-theme-16: #42CA4D;--view-priceColor:#FF7600;--view-minorColor:rgba(108, 198, 94, 0.5);--view-minorColorT:rgba(66, 202, 77, 0.1);--view-bntColor:#FE960F;--view-op-ten: rgba(66,202,77, 0.1);--view-main-start:#70E038; --view-main-over:#42CA4D;--view-op-point-four: rgba(66,202,77, 0.04);'
let red =
@@ -112,9 +113,13 @@
break
}
});
- getLangJson().then(res => {
- uni.setStorageSync('localeJson', res.data)
- })
+ console.log(Cache.has('localeJson', true))
+ if (!Cache.has('localeJson', true)) {
+ getLangJson().then(res => {
+ Cache.set('localeJson', res.data, 600);
+ // uni.setStorageSync('localeJson', res.data)
+ })
+ }
if (option.query.spread) {
that.$Cache.set('spread', option.query.spread);
that.globalData.spid = option.query.spread;
diff --git a/template/uni-app/pages/goods/lottery/grids/index.vue b/template/uni-app/pages/goods/lottery/grids/index.vue
index 4ce45476d..692514969 100644
--- a/template/uni-app/pages/goods/lottery/grids/index.vue
+++ b/template/uni-app/pages/goods/lottery/grids/index.vue
@@ -7,7 +7,7 @@
- {{$t(`恭喜您`)}},{{$t(`获得`)}} {{lottery_num}} {{$t(`time`)}}
+ {{$t(`恭喜您`)}},{{$t(`获得`)}} {{lottery_num}} {{$t(`次`)}}
diff --git a/template/uni-app/pages/goods/order_confirm/index.vue b/template/uni-app/pages/goods/order_confirm/index.vue
index 241fa6ae5..96a0bcdef 100644
--- a/template/uni-app/pages/goods/order_confirm/index.vue
+++ b/template/uni-app/pages/goods/order_confirm/index.vue
@@ -55,7 +55,7 @@
+ v-if="!pinkId && !BargainId && !combinationId && !seckillId && !advanceId && integral_open">
{{$t(`积分抵扣`)}}
{{useIntegral ? $t(`剩余积分`):$t(`当前积分`)}}
@@ -407,7 +407,8 @@
discount_id: 0,
is_shipping: true,
inputTrip: false,
- focus: true,
+ focus: true,
+ integral_open: false,
};
},
computed: mapGetters(['isLogin']),
@@ -806,7 +807,8 @@
that.$set(that, 'invoice_func', res.data.invoice_func);
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, 'virtual_type', res.data.virtual_type || 0);
+ that.$set(that, 'integral_open', res.data.integral_open);
//微信支付是否开启
that.cartArr[0].payStatus = res.data.pay_weixin_open || 0
//支付宝是否开启
diff --git a/template/uni-app/pages/user/index.vue b/template/uni-app/pages/user/index.vue
index a637864c3..cfdabe0a8 100644
--- a/template/uni-app/pages/user/index.vue
+++ b/template/uni-app/pages/user/index.vue
@@ -699,15 +699,15 @@
if (this.isLogin) {
if (url.indexOf('http') === -1) {
// #ifdef H5 || APP-PLUS
- if (name && name === this.$t(`service_reception`)) {
+ if (name && name === '客服接待') {
// return window.location.href = `${location.origin}${url}`
return uni.navigateTo({
url: `/pages/annex/web_view/index?url=${location.origin}${url}`
});
- } else if (name && name === this.$t(`contact_customer`)) {
+ } else if (name && name === '联系客服') {
return getCustomer(url)
- } else if (name === this.$t(`order_write_off`)) {
+ } else if (name === '订单核销') {
console.log(`${url}`)
return uni.navigateTo({
url: url
@@ -717,7 +717,7 @@
// #endif
// #ifdef MP
- if (name && name === this.$t(`contact_customer`)) {
+ if (name && name === '联系客服') {
return getCustomer(url)
}
if (url != '#' && url == '/pages/users/user_info/index') {
diff --git a/template/uni-app/pages/users/commission_rank/index.vue b/template/uni-app/pages/users/commission_rank/index.vue
index e4be08b64..2b4850d72 100644
--- a/template/uni-app/pages/users/commission_rank/index.vue
+++ b/template/uni-app/pages/users/commission_rank/index.vue
@@ -2,7 +2,7 @@
diff --git a/template/uni-app/pages/users/user_info/index.vue b/template/uni-app/pages/users/user_info/index.vue
index b37d0e883..10a7d6e05 100644
--- a/template/uni-app/pages/users/user_info/index.vue
+++ b/template/uni-app/pages/users/user_info/index.vue
@@ -172,6 +172,7 @@
// #ifdef MP
import authorize from '@/components/Authorize';
// #endif
+ import Cache from '@/utils/cache';
import colors from '@/mixins/color.js';
import appUpdate from "@/components/update/app-update.vue";
export default {
@@ -251,7 +252,7 @@
this.setIndex = e.detail.value
uni.setStorageSync('locale', this.array[this.setIndex].value);
getLangJson().then(res => {
- uni.setStorageSync('localeJson', res.data)
+ 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]);
diff --git a/template/uni-app/utils/cache.js b/template/uni-app/utils/cache.js
index 7a03adf0c..16ba9ee12 100644
--- a/template/uni-app/utils/cache.js
+++ b/template/uni-app/utils/cache.js
@@ -1,226 +1,230 @@
-// +----------------------------------------------------------------------
-// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
-// +----------------------------------------------------------------------
-// | Author: CRMEB Team
-// +----------------------------------------------------------------------
-
-import {
- EXPIRE
-} from '../config/app';
-
-class Cache {
-
- constructor(handler) {
- this.cacheSetHandler = uni.setStorageSync;
- this.cacheGetHandler = uni.getStorageSync;
- this.cacheClearHandler = uni.removeStorageSync;
- this.cacheExpire = 'UNI-APP-CRMEB:TAG';
- this.clearOverdue();
- }
-
- /**
- * 获取当前时间戳
- */
- time() {
- return Math.round(new Date() / 1000);
- }
-
- /**
- * 字符串转时间戳
- * @param {Object} expiresTime
- */
- strTotime(expiresTime){
- let expires_time = expiresTime.substring(0, 19);
- expires_time = expires_time.replace(/-/g, '/');
- return Math.round(new Date(expires_time).getTime() / 1000);
- }
-
-
- /**
- * 设置过期时间缓存
- * @param {Object} key
- * @param {Object} expire
- */
- setExpireCaheTag(key, expire) {
- expire = expire !== undefined ? expire : EXPIRE;
- if (typeof expire === 'number') {
- let tag = this.cacheGetHandler(this.cacheExpire), newTag = [],newKeys = [];
- if (typeof tag === 'object' && tag.length) {
- newTag = tag.map(item => {
- newKeys.push(item.key);
- if (item.key === key) {
- item.expire = expire === 0 ? 0 : this.time() + expire;
- }
- return item;
- });
- }
- if (!newKeys.length || newKeys.indexOf(key) === -1) {
- newTag.push({
- key: key,
- expire: expire === 0 ? 0 : this.time() + expire
- });
- }
- this.cacheSetHandler(this.cacheExpire, newTag);
- }
- }
-
- /**
- * 缓存是否过期,过期自动删除
- * @param {Object} key
- * @param {Object} $bool true = 删除,false = 不删除
- */
- getExpireCahe(key, $bool) {
- try {
- let tag = this.cacheGetHandler(this.cacheExpire),time = 0,index = false;
- if (typeof tag === 'object' && tag.length) {
- tag.map((item,i) => {
- if(item.key === key){
- time = item.expire
- index = i
- }
- });
- if (time) {
- let newTime = parseInt(time);
- if (time && time < this.time() && !Number.isNaN(newTime)) {
- if ($bool === undefined || $bool === true) {
- this.cacheClearHandler(key);
- if(index !== false){
- tag.splice(index,1)
- this.cacheClearHandler(this.cacheExpire,tag);
- }
- }
- return false;
- } else
- return true;
- } else {
- return !!this.cacheGetHandler(key);
- }
- }
- return false;
- } catch (e) {
- return false;
- }
- }
-
- /**
- * 设置缓存
- * @param {Object} key
- * @param {Object} data
- */
- set(key, data, expire) {
- if (data === undefined) {
- return true;
- }
- if (typeof data === 'object')
- data = JSON.stringify(data);
- try {
- this.setExpireCaheTag(key, expire);
- return this.cacheSetHandler(key, data);
- } catch (e) {
- return false;
- }
- }
-
- /**
- * 检测缓存是否存在
- * @param {Object} key
- */
- has(checkwhethethecacheexists) {
- this.clearOverdue();
- return this.getExpireCahe(checkwhethethecacheexists);
- }
-
- /**
- * 获取缓存
- * @param {Object} key
- * @param {Object} $default
- * @param {Object} expire
- */
- get(key, $default, expire) {
- this.clearOverdue();
- try {
- let isBe = this.getExpireCahe(key);
- let data = this.cacheGetHandler(key);
- if (data && isBe) {
- if (typeof $default === 'boolean')
- return JSON.parse(data);
- else
- return data;
- } else {
- if (typeof $default === 'function') {
- let value = $default();
- this.set(key, value, expire);
- return value;
- } else {
- this.set(key, $default, expire);
- return $default;
- }
- }
- } catch (e) {
- return null;
- }
- }
-
- /**
- * 删除缓存
- * @param {Object} key
- */
- clear(key) {
- try {
- let cahceValue = this.cacheGetHandler(this.cacheExpire),
- index = false;
- if (cahceValue && typeof cahceValue === 'object' && cahceValue.length) {
- cahceValue.map((item, i) => {
- if (item.key === key) {
- index = i;
- }
- });
-
- if (index !== false) {
- cahceValue.splice(index, 1);
- }
- this.cacheSetHandler(this.cacheExpire, cahceValue);
- }
- return this.cacheClearHandler(key);
- } catch (e) {
- return false;
- }
- }
-
- /**
- * 清除过期缓存
- */
- clearOverdue() {
- let cahceValue = this.cacheGetHandler(this.cacheExpire),
- time = this.time(),
- newBeOverdueValue = [],
- newTagValue = [];
-
- if (cahceValue && typeof cahceValue === 'object' && cahceValue.length) {
- cahceValue.map(item => {
- if (item) {
- if ((item.expire !== undefined && item.expire > time) || item.expire === 0) {
- newTagValue.push(item);
- } else {
- newBeOverdueValue.push(item.key);
- }
- }
- });
- }
- //保存没有过期的缓存标签
- if (newTagValue.length !== cahceValue.length) {
- this.cacheSetHandler(this.cacheExpire, newTagValue);
- }
- //删除过期缓存
- newBeOverdueValue.forEach(k => {
- this.cacheClearHandler(k);
- })
- }
-}
-
-
+// +----------------------------------------------------------------------
+// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
+// +----------------------------------------------------------------------
+// | Author: CRMEB Team
+// +----------------------------------------------------------------------
+
+import {
+ EXPIRE
+} from '../config/app';
+
+class Cache {
+
+ constructor(handler) {
+ this.cacheSetHandler = uni.setStorageSync;
+ this.cacheGetHandler = uni.getStorageSync;
+ this.cacheClearHandler = uni.removeStorageSync;
+ this.cacheExpire = 'UNI-APP-CRMEB:TAG';
+ this.clearOverdue();
+ }
+
+ /**
+ * 获取当前时间戳
+ */
+ time() {
+ return Math.round(new Date() / 1000);
+ }
+
+ /**
+ * 字符串转时间戳
+ * @param {Object} expiresTime
+ */
+ strTotime(expiresTime) {
+ let expires_time = expiresTime.substring(0, 19);
+ expires_time = expires_time.replace(/-/g, '/');
+ return Math.round(new Date(expires_time).getTime() / 1000);
+ }
+
+
+ /**
+ * 设置过期时间缓存
+ * @param {Object} key
+ * @param {Object} expire
+ */
+ setExpireCaheTag(key, expire) {
+ expire = expire !== undefined ? expire : EXPIRE;
+ if (typeof expire === 'number') {
+ let tag = this.cacheGetHandler(this.cacheExpire),
+ newTag = [],
+ newKeys = [];
+ if (typeof tag === 'object' && tag.length) {
+ newTag = tag.map(item => {
+ newKeys.push(item.key);
+ if (item.key === key) {
+ item.expire = expire === 0 ? 0 : this.time() + expire;
+ }
+ return item;
+ });
+ }
+ if (!newKeys.length || newKeys.indexOf(key) === -1) {
+ newTag.push({
+ key: key,
+ expire: expire === 0 ? 0 : this.time() + expire
+ });
+ }
+ this.cacheSetHandler(this.cacheExpire, newTag);
+ }
+ }
+
+ /**
+ * 缓存是否过期,过期自动删除
+ * @param {Object} key
+ * @param {Object} $bool true = 删除,false = 不删除
+ */
+ getExpireCahe(key, $bool) {
+ try {
+ let tag = this.cacheGetHandler(this.cacheExpire),
+ time = 0,
+ index = false;
+ if (typeof tag === 'object' && tag.length) {
+ tag.map((item, i) => {
+ if (item.key === key) {
+ time = item.expire
+ index = i
+ }
+ });
+ if (time) {
+ let newTime = parseInt(time);
+ if (time && time < this.time() && !Number.isNaN(newTime)) {
+ if ($bool === undefined || $bool === true) {
+ this.cacheClearHandler(key);
+ if (index !== false) {
+ tag.splice(index, 1)
+ this.cacheClearHandler(this.cacheExpire, tag);
+ }
+ }
+ return false;
+ } else
+ return true;
+ } else {
+ return !!this.cacheGetHandler(key);
+ }
+ }
+ return false;
+ } catch (e) {
+ return false;
+ }
+ }
+
+ /**
+ * 设置缓存
+ * @param {Object} key
+ * @param {Object} data
+ */
+ set(key, data, expire) {
+ if (data === undefined) {
+ return true;
+ }
+ if (typeof data === 'object')
+ data = JSON.stringify(data);
+ try {
+ this.setExpireCaheTag(key, expire);
+ return this.cacheSetHandler(key, data);
+ } catch (e) {
+ return false;
+ }
+ }
+
+ /**
+ * 检测缓存是否存在
+ * @param {Object} key
+ */
+ has(checkwhethethecacheexists, isDel) {
+ this.clearOverdue();
+ return this.getExpireCahe(checkwhethethecacheexists, isDel);
+ }
+
+ /**
+ * 获取缓存
+ * @param {Object} key
+ * @param {Object} $default
+ * @param {Object} expire
+ */
+ get(key, $default, expire) {
+ this.clearOverdue();
+ try {
+ let isBe = this.getExpireCahe(key);
+ let data = this.cacheGetHandler(key);
+ if (data && isBe) {
+ if (typeof $default === 'boolean')
+ return JSON.parse(data);
+ else
+ return data;
+ } else {
+ if (typeof $default === 'function') {
+ let value = $default();
+ this.set(key, value, expire);
+ return value;
+ } else {
+ this.set(key, $default, expire);
+ return $default;
+ }
+ }
+ } catch (e) {
+ return null;
+ }
+ }
+
+ /**
+ * 删除缓存
+ * @param {Object} key
+ */
+ clear(key) {
+ try {
+ let cahceValue = this.cacheGetHandler(this.cacheExpire),
+ index = false;
+ if (cahceValue && typeof cahceValue === 'object' && cahceValue.length) {
+ cahceValue.map((item, i) => {
+ if (item.key === key) {
+ index = i;
+ }
+ });
+
+ if (index !== false) {
+ cahceValue.splice(index, 1);
+ }
+ this.cacheSetHandler(this.cacheExpire, cahceValue);
+ }
+ return this.cacheClearHandler(key);
+ } catch (e) {
+ return false;
+ }
+ }
+
+ /**
+ * 清除过期缓存
+ */
+ clearOverdue() {
+ let cahceValue = this.cacheGetHandler(this.cacheExpire),
+ time = this.time(),
+ newBeOverdueValue = [],
+ newTagValue = [];
+
+ if (cahceValue && typeof cahceValue === 'object' && cahceValue.length) {
+ cahceValue.map(item => {
+ if (item) {
+ if ((item.expire !== undefined && item.expire > time) || item.expire === 0) {
+ newTagValue.push(item);
+ } else {
+ newBeOverdueValue.push(item.key);
+ }
+ }
+ });
+ }
+ //保存没有过期的缓存标签
+ if (newTagValue.length !== cahceValue.length) {
+ this.cacheSetHandler(this.cacheExpire, newTagValue);
+ }
+ //删除过期缓存
+ newBeOverdueValue.forEach(k => {
+ this.cacheClearHandler(k);
+ })
+ }
+}
+
+
export default new Cache;