3
0
Fork 0

feat(config): 全局货币符号控制展示隐藏

This commit is contained in:
woody 2025-05-28 15:10:50 +08:00
parent 96508a557c
commit 8a3cb6787c
9 changed files with 384 additions and 349 deletions

View File

@ -39,7 +39,7 @@
<view class="product-name">{{ item.waresName }}</view>
<view class="product-price-row">
<view class="product-price">
{{ formatPrice(item.waresPrice) }}
{{ formatCurrency(item.waresPrice) }}
</view>
<u-button
v-if="false"
@ -67,6 +67,7 @@
<script>
import { numberToCurrencyNo, isLocal, isLocaled } from '@/util/numberToCurrency'
import { addShopping } from '@/config/goods'
import { formatCurrency } from '@/util/index.js'
export default {
props: {
title: {
@ -75,8 +76,7 @@ export default {
},
list: {
type: Array,
default: () => [
],
default: () => [],
},
specialAreaId: {
type: [Number, String],
@ -85,7 +85,7 @@ export default {
size: {
type: String,
default: 'normal', // 'normal' or 'small'
validator: (value) => ['normal', 'small'].includes(value),
validator: value => ['normal', 'small'].includes(value),
},
},
computed: {
@ -95,6 +95,7 @@ export default {
},
methods: {
isLocaled,
formatCurrency,
formatPrice(price) {
// 使numberToCurrencyNoisLocal
return isLocal(numberToCurrencyNo(price))
@ -125,7 +126,7 @@ export default {
icon: 'success',
mask: true,
})
this.$store.dispatch("getCarLength");
this.$store.dispatch('getCarLength')
}
})
},

View File

@ -1,118 +1,150 @@
const http = uni.$u.http
// 验证码
export const captchaImage = (params) => http.get('/code', { params })
export const captchaImage = params => http.get('/code', { params })
// 登录
export const login = (params) => http.post('/member/auth/api/login', params)
export const login = params => http.post('/member/auth/api/login', params)
//用户信息
export const getInfo = (params) => http.get('/member/api/member/get-info', { params })
export const getInfo = params =>
http.get('/member/api/member/get-info', { params })
//获取个人资料
export const getData = (params) => http.get('/member/api/member/get-data', { params })
export const getData = params =>
http.get('/member/api/member/get-data', { params })
//获取会员卡信息
export const getCard = (params) => http.get('/member/api/member/get-card', { params })
export const getCard = params =>
http.get('/member/api/member/get-card', { params })
//获取验证码
export const verification = (params) => http.get('/member/api/sms/self-verification', { params })
export const verification = params =>
http.get('/member/api/sms/self-verification', { params })
//忘记密码获取验证码
export const forgetVerification = (params) => http.get('/member/api/sms/forget-verification', { params })
export const forgetVerification = params =>
http.get('/member/api/sms/forget-verification', { params })
//保存地址
export const saveAddress = (data) => http.post('/member/api/member-address/save', data)
export const saveAddress = data =>
http.post('/member/api/member-address/save', data)
//更新密码
export const updatePassword = (data) => http.put('/member/api/member/update-password', data)
export const updatePassword = data =>
http.put('/member/api/member/update-password', data)
//忘记密码更新
export const forgetPassword = (data) => http.put('/member/api/member/forget-password', data)
export const forgetPassword = data =>
http.put('/member/api/member/forget-password', data)
//获取地址详情
export const getAddress = (params) => http.get('/member/api/member-address/detail/' + params)
export const getAddress = params =>
http.get('/member/api/member-address/detail/' + params)
//获取菜单权限
export const menuList = (data) => http.get('/system/api/menu/list', data)
export const menuList = data => http.get('/system/api/menu/list', data)
//更新个人资料
export const updateData = (data) => http.put('/member/api/member/update-data', data)
export const updateData = data =>
http.put('/member/api/member/update-data', data)
//奖金来源
export const queryBonusDetail = (data, data1) => http.post('/bonus/api/bonus/query-bonus-detail/' + data1, data)
export const queryBonusDetail = (data, data1) =>
http.post('/bonus/api/bonus/query-bonus-detail/' + data1, data)
//首购收益
export const queryBonusFirst = (data, data1) => http.post('/bonus/api/bonus/query-bonus-first/' + data1, data)
export const queryBonusFirst = (data, data1) =>
http.post('/bonus/api/bonus/query-bonus-first/' + data1, data)
//复购收益
export const queryBonusRepurchase = (data, data1) => http.post('/bonus/api/bonus/query-bonus-repurchase/' + data1, data)
export const queryBonusRepurchase = (data, data1) =>
http.post('/bonus/api/bonus/query-bonus-repurchase/' + data1, data)
//嗨粉收益
export const queryBonusHiFun = (data, data1) => http.post('/bonus/api/bonus/query-bonus-hi-fun' + data1, data)
export const queryBonusHiFun = (data, data1) =>
http.post('/bonus/api/bonus/query-bonus-hi-fun' + data1, data)
//云代收益
export const queryBonusCloud = (data, data1) => http.post('/bonus/api/bonus/query-bonus-cloud/' + data1, data)
export const queryBonusCloud = (data, data1) =>
http.post('/bonus/api/bonus/query-bonus-cloud/' + data1, data)
//复购券收益
export const queryBonusCoupon = (data, data1) => http.post('/bonus/api/bonus/query-bonus-coupon/' + data1, data)
export const queryBonusCoupon = (data, data1) =>
http.post('/bonus/api/bonus/query-bonus-coupon/' + data1, data)
//创客空间收益
export const queryBonusMaker = (data, data1) => http.post('/bonus/api/bonus/query-bonus-maker/' + data1, data)
export const queryBonusMaker = (data, data1) =>
http.post('/bonus/api/bonus/query-bonus-maker/' + data1, data)
//海粉收益
export const queryBonusHaiFun = (data, data1) => http.post('/bonus/api/bonus/query-bonus-hai-fun/' + data1, data)
export const queryBonusHaiFun = (data, data1) =>
http.post('/bonus/api/bonus/query-bonus-hai-fun/' + data1, data)
//获取奖金收益类型
export const getBonusType = (params) => http.get('/system/api/bd-bonus-items/list', { params })
export const getBonusType = params =>
http.get('/system/api/bd-bonus-items/list', { params })
//获取语言下拉
//上传图片
export const updateFile = (params) => http.post('/system/upload', params)
export const updateFile = params => http.post('/system/upload', params)
// 退出方法
export const logout = () => http.delete('/member/auth/api/logout')
//订单数量
export const orderNum = (params) => http.get('/sale/api/my-order/num', { params })
export const orderNum = params => http.get('/sale/api/my-order/num', { params })
//获取用户是否显示弹窗
export const indexPopScreen = (params) => http.get('/system/api/notice/index-pop-screen', { params })
export const indexPopScreen = params =>
http.get('/system/api/notice/index-pop-screen', { params })
//菜单权限
export const getMenuList = (params) => http.get('/system/api/menu/list', { params })
export const getMenuList = params =>
http.get('/system/api/menu/list', { params })
//海粉默认登录H5扫码使用
export const autoLogin = (params) => http.post('/member/auth/api/auto-login', params)
export const autoLogin = params =>
http.post('/member/auth/api/auto-login', params)
//海粉商品
export const queryWares = (params) => http.post('/sale/api/wares/query-spe-wares-copy', params)
export const queryWares = params =>
http.post('/sale/api/wares/query-spe-wares-copy', params)
//保存礼品地址
export const saveGiftAddress = (params) => http.post('/member/api/member-gift/update-gift', params)
export const saveGiftAddress = params =>
http.post('/member/api/member-gift/update-gift', params)
//获取会员真实奖衔
export const getUserAwards = (params) => http.get('/member/api/member/index-member-awards', { params })
export const getUserAwards = params =>
http.get('/member/api/member/index-member-awards', { params })
//获取安置人编号
export const fansConvertCode = (params) => http.get('/member/api/member/fans-convert-code/'+params )
export const fansConvertCode = params =>
http.get('/member/api/member/fans-convert-code/' + params)
//获取荣誉奖衔
export const getIndexAwards = (params) => http.get('/member/api/member/index-awards', { params })
export const getIndexAwards = params =>
http.get('/member/api/member/index-awards', { params })
//当前用户短信验证码
export const selfVerification = (params) => http.get('/member/api/sms/self-verification', { params })
export const selfVerification = params =>
http.get('/member/api/sms/self-verification', { params })
// 重置支付密码获取验证码
export const resetPayPasswordVerification = (params) => http.get('/member/api/sms/reset-verification', { params })
export const resetPayPasswordVerification = params =>
http.get('/member/api/sms/reset-verification', { params })
//更新支付密码
export const forgetPayPassword = (data) => http.put('/member/api/member/forget-pay-password', data)
export const forgetPayPassword = data =>
http.put('/member/api/member/forget-pay-password', data)
// 站内信弹窗
export const getIndexPopmail = (params) => http.get('/system/api/notice/index-pop-mail', { params })
export const getIndexPopmail = params =>
http.get('/system/api/notice/index-pop-mail', { params })
//站内信弹窗已读
export const getNoticeDetail = (params) => http.get('/system/api/notice/index-detail', { params })
export const getNoticeDetail = params =>
http.get('/system/api/notice/index-detail', { params })
//校验服务有效期
export const agreement_expire = (params) => http.get('/member/api/member/agreement_expire', { params })
export const agreement_expire = params =>
http.get('/member/api/member/agreement_expire', { params })
//创客空间收益
export const markBonus = (params) => http.post('/bonus/api/bonus/query-mark-bonus-detail', params)
export const markBonus = params =>
http.post('/bonus/api/bonus/query-mark-bonus-detail', params)

View File

@ -5,7 +5,14 @@
* @Date: 2022-05-24 14:43:45
*/
import { getToken, removeToken } from '@/config/auth.js'
module.exports = vm => {
// 检查uni.$u.http是否可用
if (!uni || !uni.$u || !uni.$u.http) {
console.warn('uni.$u.http is not available, request configuration skipped')
return
}
// 初始化请求配置
uni.$u.http.setConfig(config => {
// config.baseURL = 'https://p1.hzs413.com/inter-api';
@ -13,7 +20,7 @@ module.exports = vm => {
//#ifdef DEV_SERVER
console.log('DEV_SERVER')
config.baseURL = 'http://localhost:8080'
config.baseURL = '/prod-api'
//#endif
//#ifdef QA_SERVER

View File

@ -1,23 +1,9 @@
<!--
* @Descripttion:
* @version:
* @Author: kBank
* @Date: 2022-11-21 15:11:22
-->
<template>
<view :class="userInfo.skin ? 'content1' : 'content'">
<view class="content_a">
<!-- 商品专区入口 先别删 -->
<!-- <view @tap="goSpecialArea">会员专区</view> -->
<view :class="userInfo.skin ? 'index-top1' : 'index-top'">
<!-- <view class="index_t">
<view class="index-left">
<view class="english">GLOBALIZATION</view>
<view class="text">{{ '全球一体化' }}</view>
</view>
</view> -->
</view>
<view :class="userInfo.skin ? 'index-top1' : 'index-top'"> </view>
<view class="banner" v-if="isEmpty(goodsList.advertBannerList) == false">
<view class="uni-margin-wrap">
@ -43,10 +29,7 @@
</view>
<view class="goods-sort">
<view class="goods-flexs">
<view
v-for="(item, index) in recommendSpecialAreaList"
:key="index"
>
<view v-for="(item, index) in recommendSpecialAreaList" :key="index">
<view
class="goods-view"
@click="navTap(item)"
@ -88,7 +71,6 @@
</view>
</view>
<view class="goods_content">
<view
class="goods-center-lists"
v-for="item in goodsList.waresVoList"
@ -111,22 +93,27 @@
class="goods-price"
v-if="item.specialArea == 31 && userInfo.isMakerSpace == 1"
>
<span class="price-symbol"></span>
<span v-if="priceSymbolVisible" class="price-symbol">
{{ priceSymbol }}
</span>
<span>{{ formatCurrency(item.vipPrice) }}</span>
</view>
<view class="goods-price" v-if="item.specialArea != 31">
<span class="price-symbol"></span>
<span v-if="priceSymbolVisible" class="price-symbol">
{{ priceSymbol }}
</span>
<span>{{ formatCurrency(item.waresPrice) }}</span>
</view>
<view
class="goods-price"
v-if="item.specialArea == 31 && userInfo.isMakerSpace == 0"
>
<span class="price-symbol"></span>
<span v-if="priceSymbolVisible" class="price-symbol">
{{ priceSymbol }}
</span>
<span>{{ formatCurrency(item.waresPrice) }}</span>
</view>
</view>
</view>
</view>
</view>
@ -174,39 +161,40 @@
<script>
// import titleLine from '@/components/titleLine.vue'
import * as api from "@/config/login.js";
import * as apis from "@/config/index.js";
import * as ban from "@/config/balance.js";
import * as api from '@/config/login.js'
import * as apis from '@/config/index.js'
import * as ban from '@/config/balance.js'
import { getAreaGoods } from '@/config/special-area'
import clTabbar from "@/components/cl-tabbar.vue";
import noticePopup from "@/components/noticePopup.vue";
import getTree from "@/components/getTree.vue";
import znNewsPopup from "@/components/znNewsPopup.vue";
import clTabbar from '@/components/cl-tabbar.vue'
import noticePopup from '@/components/noticePopup.vue'
import getTree from '@/components/getTree.vue'
import znNewsPopup from '@/components/znNewsPopup.vue'
import areaProductList from '@/components/area-product-list/index.vue'
import { formatCurrency } from '@/util/index.js'
import { mapGetters } from 'vuex'
export default {
components: {
noticePopup,
znNewsPopup,
"cl-tabbar": clTabbar,
'cl-tabbar': clTabbar,
getTree,
areaProductList
areaProductList,
},
filters: {
seles(value) {
if (value > 999) {
return 999 + "+";
return 999 + '+'
} else {
return value;
return value
}
},
},
data() {
return {
promptFlag: false,
promptMsg: "",
confirmText: "",
userInfo: uni.getStorageSync("User"),
promptMsg: '',
confirmText: '',
userInfo: uni.getStorageSync('User'),
moreFlag: false,
index: 0,
indicatorDots: true,
@ -219,18 +207,18 @@ export default {
{
label: '注册专区',
value: 1,
name: "regiest",
name: 'regiest',
children: [
{
label: '自营专区',
value: 1,
name: "regiestArea",
name: 'regiestArea',
isShow: true,
},
{
label: "乐学易考",
label: '乐学易考',
value: 24,
name: "ezLearnReg",
name: 'ezLearnReg',
isShow: true,
},
],
@ -238,24 +226,24 @@ export default {
{
label: '升级专区',
value: 2,
name: "upgrade",
name: 'upgrade',
children: [
{
label: '自营专区',
value: 2,
name: "upgradeArea",
name: 'upgradeArea',
isShow: true,
},
{
label: '海粉专区',
value: 27,
name: "haiFunUpd",
name: 'haiFunUpd',
isShow: true,
},
{
label: "乐学易考",
label: '乐学易考',
value: 25,
name: "ezLearnUp",
name: 'ezLearnUp',
isShow: true,
},
],
@ -264,43 +252,43 @@ export default {
{
label: '复购专区',
value: 3,
name: "repurchase",
name: 'repurchase',
children: [
{
label: '自营专区',
value: 3,
name: "self",
name: 'self',
isShow: true,
},
{
label: "乐学易考",
label: '乐学易考',
value: 26,
name: "ezLearnRep",
name: 'ezLearnRep',
isShow: true,
},
{
label: '免费注册',
value: 21,
name: "haiFans",
name: 'haiFans',
isShow: true,
},
{
label: '复购合作',
value: 22,
name: "cooperation",
name: 'cooperation',
isShow: true,
},
{
label: '直播专区',
value: 14,
name: "live",
name: 'live',
isShow: true,
},
{
label: '工具流',
value: 12,
name: "gongju",
name: 'gongju',
isShow: true,
},
],
@ -309,53 +297,53 @@ export default {
label: '福利专区',
value: 13,
children: [],
name: "welfare",
name: 'welfare',
},
{
label: '积分专区',
value: 11,
children: [],
name: "integral",
name: 'integral',
},
{
label: '重消专区',
value: 10,
children: [],
name: "rescission",
name: 'rescission',
},
{
label: "专供专区",
label: '专供专区',
value: 31,
children: [],
name: "wolesaleArea",
name: 'wolesaleArea',
},
{
label: "续约专区",
label: '续约专区',
value: 30,
children: [],
name: "renewalArea",
name: 'renewalArea',
},
{
label: '创客空间专区',
value: 28,
children: [],
name: "makerArea",
name: 'makerArea',
},
{
label: '架构管理',
value: 6,
name: "frame",
name: 'frame',
children: [
{
label: '安置架构',
value: 6,
name: "architecture",
name: 'architecture',
isShow: true,
},
{
label: '推荐架构',
value: 7,
name: "recommend",
name: 'recommend',
isShow: true,
},
],
@ -363,18 +351,18 @@ export default {
{
label: '分享专区',
value: 7,
name: "share",
name: 'share',
children: [
{
label: '海粉分享',
value: 7,
name: "hiFans",
name: 'hiFans',
isShow: true,
},
{
label: '免费注册',
value: 21,
name: "haiFans",
name: 'haiFans',
isShow: true,
},
],
@ -399,260 +387,257 @@ export default {
],
},
],
};
}
},
computed: {
...mapGetters(['priceSymbol', 'priceSymbolVisible']),
},
onLoad() {
if (
uni.getStorageSync("showInfo") == undefined ||
uni.getStorageSync("showInfo") == 0
uni.getStorageSync('showInfo') == undefined ||
uni.getStorageSync('showInfo') == 0
) {
}
this.getGoodsInfo();
this.getAreaGoods();
this.getGoodsInfo()
this.getAreaGoods()
// this.getLanguage();
this.getService();
this.getService()
},
onShow() {
this.$store.dispatch("getCarLength");
this.$store.dispatch('getCarLength')
},
onPullDownRefresh() {
let that = this;
let that = this
setTimeout(() => {
that.getGoodsInfo();
uni.stopPullDownRefresh(); //
}, 1000);
that.getGoodsInfo()
uni.stopPullDownRefresh() //
}, 1000)
},
methods: {
formatCurrency,
formatSales(value) {
if (value > 999) {
return "999+";
return '999+'
} else {
return value;
return value
}
},
formatCurrency(value) {
// Simple currency formatting, adapt if needed (e.g., using Intl.NumberFormat or a library)
if (typeof value !== 'number') {
return value;
}
return value.toFixed(2); // Assumes 2 decimal places
},
goAreaUrl() {
ban.agreementName().then((res) => {
ban.agreementName().then(res => {
if (res.data == 0) {
uni.navigateTo({
url:
"/pages/specialArea/list?label=续约专区" +
"&specialArea=30" +
"&children=[]",
});
'/pages/specialArea/list?label=续约专区' +
'&specialArea=30' +
'&children=[]',
})
} else {
uni.showModal({
title: '提示',
content: '请先进行实名认证',
success: (res) => {
success: res => {
if (res.confirm) {
uni.navigateTo({
url: "/pages/selfService/realName/realName",
});
url: '/pages/selfService/realName/realName',
})
}
},
});
})
}
});
})
},
getAreaGoods() {
getAreaGoods().then((res) => {
getAreaGoods().then(res => {
this.recommendSpecialAreaList = res.data?.recommendSpecialAreaList || []
})
},
toDel() {
this.promptFlag = false;
this.promptFlag = false
if (this.jumpPage == 1) {
uni.navigateTo({
url: "/pages/selfService/realName/realName",
});
url: '/pages/selfService/realName/realName',
})
} else {
uni.navigateTo({
url:
"/pages/specialArea/list?label=续约专区" +
"&specialArea=30" +
"&children=[]",
});
'/pages/specialArea/list?label=续约专区' +
'&specialArea=30' +
'&children=[]',
})
}
},
getService() {
api.agreement_expire().then((res) => {
api.agreement_expire().then(res => {
if (res.code == 200) {
this.promptFlag = res.data.promptFlag ? false : true;
this.promptMsg = res.data.promptMsg;
this.jumpPage = res.data.jumpPage;
this.promptFlag = res.data.promptFlag ? false : true
this.promptMsg = res.data.promptMsg
this.jumpPage = res.data.jumpPage
// confirmText
if (this.jumpPage == 1) {
this.confirmText = "实名认证";
this.confirmText = '实名认证'
} else {
this.confirmText = "立即续约";
this.confirmText = '立即续约'
}
}
});
})
},
callChildMethod() {
this.$refs.child.getUserTc();
this.$refs.child.getUserTc()
},
callznMethod() {
this.$refs.child2.getUserTc2();
this.$refs.child2.getUserTc2()
},
//
getTree() {
this.$refs.tree.getData();
this.$refs.tree.getData()
},
isEmpty(v) {
switch (typeof v) {
case "undefined":
return true;
case "string":
if (v.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g, "").length == 0)
return true;
break;
case "boolean":
if (!v) return true;
break;
case "number":
if (0 === v || isNaN(v)) return true;
break;
case "object":
if (null === v || v.length === 0) return true;
case 'undefined':
return true
case 'string':
if (v.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g, '').length == 0)
return true
break
case 'boolean':
if (!v) return true
break
case 'number':
if (0 === v || isNaN(v)) return true
break
case 'object':
if (null === v || v.length === 0) return true
for (var i in v) {
return false;
return false
}
return true;
return true
}
return false;
return false
},
more() {
this.moreFlag = true;
this.moreFlag = true
},
openKf() {
let userInfo = uni.getStorageSync("User");
let userInfo = uni.getStorageSync('User')
let src =
"https://im1c5366d.7x24cc.com/phone_webChat.html?accountId=N000000033467&chatId=302384fb-eda1-436e-a5e9-c03a2dbd6e97&visitorId=" +
'https://im1c5366d.7x24cc.com/phone_webChat.html?accountId=N000000033467&chatId=302384fb-eda1-436e-a5e9-c03a2dbd6e97&visitorId=' +
userInfo.memberCode +
"&nickName=" +
userInfo.memberCode;
window.open(src, "_blank");
'&nickName=' +
userInfo.memberCode
window.open(src, '_blank')
},
bannerTap(urls) {
if (urls) {
window.location.href = urls;
window.location.href = urls
}
},
getGoodsInfo() {
apis.userIndex().then((res) => {
this.goodsList = res.data;
});
apis.userIndex().then(res => {
this.goodsList = res.data
})
},
goUrl(item) {
ban.agreementName().then((res) => {
ban.agreementName().then(res => {
if (res.data == 0) {
uni.navigateTo({
url:
"/pages/specialArea/details?waresCode=" +
'/pages/specialArea/details?waresCode=' +
item.waresCode +
"&specialArea=" +
'&specialArea=' +
item.specialArea,
});
})
} else {
uni.showModal({
title: '提示',
content: '请先进行实名认证',
success: (res) => {
success: res => {
if (res.confirm) {
uni.navigateTo({
url: "/pages/selfService/realName/realName",
});
url: '/pages/selfService/realName/realName',
})
}
},
});
})
}
});
})
},
goDetails(item) {
if (item.preSaleStatus == 3 || item.isSale == 1) {
} else {
if (item.specialArea == 30) {
this.goUrl(item);
this.goUrl(item)
} else {
uni.navigateTo({
url:
"/pages/specialArea/details?waresCode=" +
'/pages/specialArea/details?waresCode=' +
item.waresCode +
"&specialArea=" +
'&specialArea=' +
item.specialArea,
});
})
}
}
},
navTap(item) {
let tapx = -1;
let tapx = -1
this.zoneList.forEach((items, index) => {
if (items.value == item.specialArea) {
tapx = index;
tapx = index
}
});
})
if (tapx == -1) {
this.zoneList.forEach((items, index) => {
items.children.forEach((ctem) => {
items.children.forEach(ctem => {
if (ctem.value == item.specialArea) {
if (item.specialArea == 21) {
uni.navigateTo({
url:
"/pages/specialArea/haIndex?label=" +
'/pages/specialArea/haIndex?label=' +
item.specialAreaName +
"&specialArea=21&diff=1",
});
'&specialArea=21&diff=1',
})
} else {
uni.navigateTo({
url:
"/pages/specialArea/list?label=" +
'/pages/specialArea/list?label=' +
items.label +
"&specialArea=" +
'&specialArea=' +
items.value +
"&childArea=" +
'&childArea=' +
item.specialArea +
"&children=" +
'&children=' +
JSON.stringify(items.children) +
"&diff=1",
});
'&diff=1',
})
}
}
});
});
})
})
} else {
if (item.specialArea == 30) {
this.goAreaUrl();
this.goAreaUrl()
} else {
uni.navigateTo({
url:
"/pages/specialArea/list?label=" +
'/pages/specialArea/list?label=' +
item.specialAreaName +
"&specialArea=" +
'&specialArea=' +
item.specialArea +
"&children=" +
'&children=' +
JSON.stringify(this.zoneList[tapx].children) +
"&diff=1",
});
'&diff=1',
})
}
}
},
goSpecialArea() {
uni.navigateTo({
url: "/pages/index/specialArea/index",
});
url: '/pages/index/specialArea/index',
})
},
},
};
}
</script>
<style lang="scss" scoped>
@ -666,7 +651,7 @@ export default {
}
}
.content1 {
background: url("~@/static/images/fBgd.jpg") no-repeat;
background: url('~@/static/images/fBgd.jpg') no-repeat;
background-size: 100% 100%;
height: 100vh;
.content_a {
@ -697,10 +682,6 @@ header {
padding: 0 20rpx;
}
.goods-name {
width: 100%;
margin-top: 10rpx;
@ -716,8 +697,6 @@ header {
// min-height: calc(26rpx * 1.4 * 2);
}
.goods-center-lists {
width: calc(100% - 40rpx); // height: 450rpx;
background: #ffffff;
@ -844,10 +823,6 @@ header {
}
.goods-flexs {
.goods-view {
position: relative;
// width: 302rpx; // height: 180rpx;
@ -891,31 +866,6 @@ header {
height: 495rpx;
}
:v-deep .uni-swiper-dots-horizontal .uni-swiper-dot {
margin-right: 5rpx;
}
:v-deep .swiper-s .uni-swiper-dots .uni-swiper-dot {
width: 14rpx;
height: 14rpx;
background: #ffffff;
border-radius: 50%;
}
:v-deep uni-swiper .uni-swiper-dot {
width: 40rpx;
height: 6rpx;
background: #fff !important;
border-radius: 10rpx;
}
:v-deep uni-swiper .uni-swiper-dot-active {
width: 40rpx;
height: 6rpx;
background: #f94856 !important;
border-radius: 10rpx;
}
.swiper-items {
// height: 495rpx;
// width: 340rpx;
@ -1007,7 +957,7 @@ page {
}
}
.index-top1 {
background: url("~@/static/images/tBgd.jpg") no-repeat;
background: url('~@/static/images/tBgd.jpg') no-repeat;
background-size: 100% 100%;
// padding: 30rpx 20rpx; // height: 100rpx;
// background-color: #fff;

View File

@ -8,5 +8,8 @@ const getters = {
shopCarLength: state => state.user.shopCarLength,
smallCarLength: state => state.user.smallCarLength,
user: state => state.user.user,
priceSymbol: state => state.system.priceSymbol,
priceDecimal: state => state.system.priceDecimal,
priceSymbolVisible: state => state.system.priceSymbolVisible,
}
export default getters

View File

@ -1,20 +1,16 @@
/*
* @Descripttion:
* @version:
* @Author: kBank
* @Date: 2022-11-23 10:15:02
*/
import Vue from 'vue'
import Vuex from 'vuex'
import getters from './getters'
import system from './modules/system'
import user from './modules/user'
Vue.use(Vuex)
const store = new Vuex.Store({
modules: {
user
user,
system,
},
getters
getters,
})
export default store

19
store/modules/system.js Normal file
View File

@ -0,0 +1,19 @@
const getDefaultState = () => {
return {
priceSymbol: '¥',
priceDecimal: 2,
priceSymbolVisible: false,
}
}
const state = getDefaultState()
const mutations = {}
const actions = {}
export default {
state,
mutations,
actions,
}

View File

@ -1,18 +1,12 @@
/*
* @Descripttion:
* @version:
* @Author: kBank
* @Date: 2022-10-24 10:45:39
*/
import { getInfo, logout } from '@/config/login.js'
import { removeToken } from '@/config/auth.js'
import { getInfo, logout } from '@/config/login.js'
import { getShoppingCount, getSmallCount } from '@/config/goods'
const getDefaultState = () => {
return {
user: '',
shopCarLength: 0,
smallCarLength: 0
smallCarLength: 0,
}
}
@ -27,20 +21,22 @@ const mutations = {
},
SET_SHOP_CAR_LENGTH: (state, data) => {
state.shopCarLength = data
}
},
}
const actions = {
// 获取用户信息
GetInfo({ commit, state }) {
return new Promise((resolve, reject) => {
getInfo().then(res => {
getInfo()
.then(res => {
if (res) {
commit('SET_USER', res.data)
uni.setStorageSync("User", res.data);
uni.setStorageSync('User', res.data)
resolve(res)
}
}).catch(error => {
})
.catch(error => {
reject(error)
})
})
@ -49,10 +45,12 @@ const actions = {
// 退出登录
LogOut({ commit, state }) {
return new Promise((resolve, reject) => {
logout(state.token).then(() => {
logout(state.token)
.then(() => {
removeToken()
resolve()
}).catch(error => {
})
.catch(error => {
reject(error)
})
})
@ -66,7 +64,6 @@ const actions = {
pkCountry = uni.getStorageSync('pkCountry')
} else {
pkCountry = userInfo.pkSettleCountry
}
} else {
pkCountry = userInfo.pkSettleCountry
@ -82,7 +79,6 @@ const actions = {
}
})
}
})
})
},
@ -91,12 +87,11 @@ const actions = {
},
setShopCarLength({ commit }, data) {
commit('SET_SHOP_CAR_LENGTH', data)
}
},
}
export default {
state,
mutations,
actions
actions,
}

View File

@ -1,8 +1,7 @@
//该方法用于给日期、时间补零
function addZero(num) {
if (parseInt(num) < 10) {
num = "0" + num
num = '0' + num
}
return num
}
@ -17,69 +16,102 @@ function formatMsToDate(ms) {
// oHour = oDate.getHours(),
// oMin = oDate.getMinutes(),
// oSen = oDate.getSeconds(),
oTime = oYear + '-' + addZero(oMonth) + '-' + addZero(oDay);
return oTime;
oTime = oYear + '-' + addZero(oMonth) + '-' + addZero(oDay)
return oTime
} else {
return ""
return ''
}
}
//判断值是否为空
function isEmpty(v) {
switch (typeof v) {
case 'undefined':
return true;
return true
case 'string':
if (v.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g, '').length == 0) return true;
break;
if (v.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g, '').length == 0) return true
break
case 'boolean':
if (!v) return true;
break;
if (!v) return true
break
case 'number':
if (0 === v || isNaN(v)) return true;
break;
if (0 === v || isNaN(v)) return true
break
case 'object':
if (null === v || v.length === 0) return true;
if (null === v || v.length === 0) return true
for (var i in v) {
return false;
return false
}
return true;
return true
}
return false;
return false
}
function formatSeconds(second_time) {
var time = parseInt(second_time) + "天";
var time = parseInt(second_time) + '天'
if (parseInt(second_time) >= 60) {
var second = parseInt(second_time) % 60;
var min = parseInt(second_time / 60);
var second = parseInt(second_time) % 60
var min = parseInt(second_time / 60)
if (second == 0) {
// time = min + "分";
} else {
// time = min + "分" + second + "秒";
}
if (min > 60) {
min = parseInt(second_time / 60) % 60;
var hour = parseInt(parseInt(second_time / 60) / 60);
min = parseInt(second_time / 60) % 60
var hour = parseInt(parseInt(second_time / 60) / 60)
if (second == 0) {
// time = hour + "小时";
} else {
// time = hour + "小时";
}
if (hour > 24) {
hour = parseInt(parseInt(second_time / 60) / 60) % 24;
var day = parseInt(parseInt(parseInt(second_time / 60) / 60) / 24);
hour = parseInt(parseInt(second_time / 60) / 60) % 24
var day = parseInt(parseInt(parseInt(second_time / 60) / 60) / 24)
if (second == 0) {
time = day + "天";
time = day + '天'
} else {
time = day + "天";
time = day + '天'
}
}
}
} else {
time = time
}
return time
}
function formatCurrency(value) {
// 处理空值或无效值
if (value === null || value === undefined || value === '') {
return value
}
// 转换为数字类型
const numValue = typeof value === 'string' ? parseFloat(value) : value
// 验证是否为有效数字
if (isNaN(numValue)) {
return value
}
// 截断到两位小数(不四舍五入)
const truncated = Math.floor(numValue * 100) / 100
// 添加千分位分隔符的函数
function addThousandSeparator(num) {
return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')
}
// 判断是否有小数部分
if (truncated % 1 === 0) {
// 整数,不显示小数位,但添加千分位分隔符
return addThousandSeparator(truncated)
} else {
// 有小数,保留两位,并为整数部分添加千分位分隔符
const fixedValue = truncated.toFixed(2)
const parts = fixedValue.split('.')
parts[0] = addThousandSeparator(parts[0])
return parts.join('.')
}
}
} else {
time = time;
}
return time;
}
export {
formatMsToDate,isEmpty,formatSeconds
}
export { formatCurrency, formatMsToDate, formatSeconds, isEmpty }