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-name">{{ item.waresName }}</view>
<view class="product-price-row"> <view class="product-price-row">
<view class="product-price"> <view class="product-price">
{{ formatPrice(item.waresPrice) }} {{ formatCurrency(item.waresPrice) }}
</view> </view>
<u-button <u-button
v-if="false" v-if="false"
@ -67,6 +67,7 @@
<script> <script>
import { numberToCurrencyNo, isLocal, isLocaled } from '@/util/numberToCurrency' import { numberToCurrencyNo, isLocal, isLocaled } from '@/util/numberToCurrency'
import { addShopping } from '@/config/goods' import { addShopping } from '@/config/goods'
import { formatCurrency } from '@/util/index.js'
export default { export default {
props: { props: {
title: { title: {
@ -75,8 +76,7 @@ export default {
}, },
list: { list: {
type: Array, type: Array,
default: () => [ default: () => [],
],
}, },
specialAreaId: { specialAreaId: {
type: [Number, String], type: [Number, String],
@ -85,7 +85,7 @@ export default {
size: { size: {
type: String, type: String,
default: 'normal', // 'normal' or 'small' default: 'normal', // 'normal' or 'small'
validator: (value) => ['normal', 'small'].includes(value), validator: value => ['normal', 'small'].includes(value),
}, },
}, },
computed: { computed: {
@ -95,6 +95,7 @@ export default {
}, },
methods: { methods: {
isLocaled, isLocaled,
formatCurrency,
formatPrice(price) { formatPrice(price) {
// 使numberToCurrencyNoisLocal // 使numberToCurrencyNoisLocal
return isLocal(numberToCurrencyNo(price)) return isLocal(numberToCurrencyNo(price))
@ -125,7 +126,7 @@ export default {
icon: 'success', icon: 'success',
mask: true, mask: true,
}) })
this.$store.dispatch("getCarLength"); this.$store.dispatch('getCarLength')
} }
}) })
}, },
@ -157,10 +158,10 @@ export default {
} }
.header-bg { .header-bg {
left: -16rpx; left: -16rpx;
right: -16rpx; right: -16rpx;
border-top-left-radius: 6px; border-top-left-radius: 6px;
border-top-right-radius: 6px; border-top-right-radius: 6px;
} }
.area-title { .area-title {
@ -188,7 +189,7 @@ export default {
} }
.product-item { .product-item {
padding: 0 8rpx; padding: 0 8rpx;
} }
.product-image { .product-image {

View File

@ -1,118 +1,150 @@
const http = uni.$u.http 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 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扫码使用 //海粉默认登录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 * @Date: 2022-05-24 14:43:45
*/ */
import { getToken, removeToken } from '@/config/auth.js' import { getToken, removeToken } from '@/config/auth.js'
module.exports = vm => { 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 => { uni.$u.http.setConfig(config => {
// config.baseURL = 'https://p1.hzs413.com/inter-api'; // config.baseURL = 'https://p1.hzs413.com/inter-api';
@ -13,7 +20,7 @@ module.exports = vm => {
//#ifdef DEV_SERVER //#ifdef DEV_SERVER
console.log('DEV_SERVER') console.log('DEV_SERVER')
config.baseURL = 'http://localhost:8080' config.baseURL = '/prod-api'
//#endif //#endif
//#ifdef QA_SERVER //#ifdef QA_SERVER

View File

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

View File

@ -1,6 +1,6 @@
/* /*
* @Descripttion: * @Descripttion:
* @version: * @version:
* @Author: kBank * @Author: kBank
* @Date: 2022-10-24 10:45:39 * @Date: 2022-10-24 10:45:39
*/ */
@ -8,5 +8,8 @@ const getters = {
shopCarLength: state => state.user.shopCarLength, shopCarLength: state => state.user.shopCarLength,
smallCarLength: state => state.user.smallCarLength, smallCarLength: state => state.user.smallCarLength,
user: state => state.user.user, user: state => state.user.user,
priceSymbol: state => state.system.priceSymbol,
priceDecimal: state => state.system.priceDecimal,
priceSymbolVisible: state => state.system.priceSymbolVisible,
} }
export default getters 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 Vue from 'vue'
import Vuex from 'vuex' import Vuex from 'vuex'
import getters from './getters' import getters from './getters'
import system from './modules/system'
import user from './modules/user' import user from './modules/user'
Vue.use(Vuex) Vue.use(Vuex)
const store = new Vuex.Store({ const store = new Vuex.Store({
modules: { modules: {
user user,
system,
}, },
getters getters,
}) })
export default store 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 { removeToken } from '@/config/auth.js'
import { getInfo, logout } from '@/config/login.js'
import { getShoppingCount,getSmallCount } from '@/config/goods' import { getShoppingCount, getSmallCount } from '@/config/goods'
const getDefaultState = () => { const getDefaultState = () => {
return { return {
user: '', user: '',
shopCarLength: 0, shopCarLength: 0,
smallCarLength: 0 smallCarLength: 0,
} }
} }
@ -27,34 +21,38 @@ const mutations = {
}, },
SET_SHOP_CAR_LENGTH: (state, data) => { SET_SHOP_CAR_LENGTH: (state, data) => {
state.shopCarLength = data state.shopCarLength = data
} },
} }
const actions = { const actions = {
// 获取用户信息 // 获取用户信息
GetInfo({ commit, state }) { GetInfo({ commit, state }) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
getInfo().then(res => { getInfo()
if (res) { .then(res => {
commit('SET_USER', res.data) if (res) {
uni.setStorageSync("User", res.data); commit('SET_USER', res.data)
resolve(res) uni.setStorageSync('User', res.data)
} resolve(res)
}).catch(error => { }
reject(error) })
}) .catch(error => {
reject(error)
})
}) })
}, },
// 退出登录 // 退出登录
LogOut({ commit, state }) { LogOut({ commit, state }) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
logout(state.token).then(() => { logout(state.token)
removeToken() .then(() => {
resolve() removeToken()
}).catch(error => { resolve()
reject(error) })
}) .catch(error => {
reject(error)
})
}) })
}, },
getCarLength({ commit }, data) { getCarLength({ commit }, data) {
@ -66,7 +64,6 @@ const actions = {
pkCountry = uni.getStorageSync('pkCountry') pkCountry = uni.getStorageSync('pkCountry')
} else { } else {
pkCountry = userInfo.pkSettleCountry pkCountry = userInfo.pkSettleCountry
} }
} else { } else {
pkCountry = userInfo.pkSettleCountry pkCountry = userInfo.pkSettleCountry
@ -82,7 +79,6 @@ const actions = {
} }
}) })
} }
}) })
}) })
}, },
@ -91,12 +87,11 @@ const actions = {
}, },
setShopCarLength({ commit }, data) { setShopCarLength({ commit }, data) {
commit('SET_SHOP_CAR_LENGTH', data) commit('SET_SHOP_CAR_LENGTH', data)
} },
} }
export default { export default {
state, state,
mutations, mutations,
actions actions,
} }

View File

@ -1,13 +1,12 @@
//该方法用于给日期、时间补零 //该方法用于给日期、时间补零
function addZero(num) { function addZero(num) {
if (parseInt(num) < 10) { if (parseInt(num) < 10) {
num = "0" + num num = '0' + num
} }
return num return num
} }
//把毫秒数转化成具体日期 2021-06-04 //把毫秒数转化成具体日期 2021-06-04
//参数 毫秒数 //参数 毫秒数
function formatMsToDate(ms) { function formatMsToDate(ms) {
if (ms) { if (ms) {
var oDate = new Date(ms), var oDate = new Date(ms),
@ -17,69 +16,102 @@ function formatMsToDate(ms) {
// oHour = oDate.getHours(), // oHour = oDate.getHours(),
// oMin = oDate.getMinutes(), // oMin = oDate.getMinutes(),
// oSen = oDate.getSeconds(), // oSen = oDate.getSeconds(),
oTime = oYear + '-' + addZero(oMonth) + '-' + addZero(oDay); oTime = oYear + '-' + addZero(oMonth) + '-' + addZero(oDay)
return oTime; return oTime
} else { } else {
return "" return ''
} }
} }
//判断值是否为空 //判断值是否为空
function isEmpty(v) { function isEmpty(v) {
switch (typeof v) { switch (typeof v) {
case 'undefined': case 'undefined':
return true; return true
case 'string': case 'string':
if (v.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g, '').length == 0) return true; if (v.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g, '').length == 0) return true
break; break
case 'boolean': case 'boolean':
if (!v) return true; if (!v) return true
break; break
case 'number': case 'number':
if (0 === v || isNaN(v)) return true; if (0 === v || isNaN(v)) return true
break; break
case 'object': case 'object':
if (null === v || v.length === 0) return true; if (null === v || v.length === 0) return true
for (var i in v) { for (var i in v) {
return false; return false
} }
return true; return true
} }
return false; return false
} }
function formatSeconds(second_time) { function formatSeconds(second_time) {
var time = parseInt(second_time) + "天"; var time = parseInt(second_time) + '天'
if (parseInt(second_time) >= 60) { if (parseInt(second_time) >= 60) {
var second = parseInt(second_time) % 60; var second = parseInt(second_time) % 60
var min = parseInt(second_time / 60); var min = parseInt(second_time / 60)
if (second == 0) { if (second == 0) {
// time = min + "分"; // time = min + "分";
} else { } else {
// time = min + "分" + second + "秒"; // time = min + "分" + second + "秒";
} }
if (min > 60) { if (min > 60) {
min = parseInt(second_time / 60) % 60; min = parseInt(second_time / 60) % 60
var hour = parseInt(parseInt(second_time / 60) / 60); var hour = parseInt(parseInt(second_time / 60) / 60)
if (second == 0) { if (second == 0) {
// time = hour + "小时"; // time = hour + "小时";
} else { } else {
// time = hour + "小时"; // time = hour + "小时";
} }
if (hour > 24) { if (hour > 24) {
hour = 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); var day = parseInt(parseInt(parseInt(second_time / 60) / 60) / 24)
if (second == 0) { if (second == 0) {
time = day + "天"; time = day + '天'
} else { } else {
time = day + "天"; time = day + '天'
} }
} }
} }
} else { } else {
time = time; time = time
} }
return time; return time
} }
export {
formatMsToDate,isEmpty,formatSeconds 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('.')
}
}
export { formatCurrency, formatMsToDate, formatSeconds, isEmpty }