Commit 4273bf12 authored by lizhan's avatar lizhan

📝 【TASK-20240815-01】TASK:接口联调

兑现详情、兑换日志、兑换礼品、积分页礼品列表、活动列表、活动详情、邮寄订单 接口联调
parent 0b22565d
...@@ -3,36 +3,41 @@ ...@@ -3,36 +3,41 @@
<dHeader :title="'活动详情'"></dHeader> <dHeader :title="'活动详情'"></dHeader>
<view class="container"> <view class="container">
<view class="img-box"> <view class="img-box">
<image class="img" src="../../static/img/company.png"></image> <image
class="img"
:src="locale === 'zh' ? detail.coverImageZh : detail.coverImageEn"
></image>
</view> </view>
<view class="container-main"> <view class="container-main">
<view class="activity-title">转发领优惠</view> <view class="activity-title">{{ locale === 'zh' ? detail.titleZh : detail.titleEn }}</view>
<view class="activity-remark" <view class="activity-remark" v-if="detail.extraRecommend">
>活动时间:2020-12-12 12:12:12活动时间:2020-12-12 12:12:12活动时间:2020-12-12 {{
12:12:12活动时间:2020-12-12 12:12:12活动时间:2020-12-12 12:12:12活动时间:2020-12-12 locale === 'zh'
12:12:12活动时间:2020-12-12 12:12:12活动时间:2020-12-12 12:12:12</view ? detail.extraRecommend.shareContentZh
> : detail.extraRecommend.shareContentEn
}}
</view>
<view class="activity-cell"> <view class="activity-cell">
<view class="cell-label">积分说明</view> <view class="cell-label">积分说明</view>
<view class="cell-content"> <view class="cell-content">
<image class="cell-image" src="../../static/img/score_b.png"></image> <image class="cell-image" src="../../static/img/score_b.png"></image>
<view class="cell-text">10</view> <view class="cell-text">{{ detail.getScoreOnce }}</view>
</view> </view>
</view> </view>
<view class="activity-cell"> <view class="activity-cell">
<view class="cell-label">累计最高积分</view> <view class="cell-label">累计最高积分</view>
<view class="cell-content"> <view class="cell-content">
<image class="cell-image" src="../../static/img/score_b.png"></image> <image class="cell-image" src="../../static/img/score_b.png"></image>
<view class="cell-text">100</view> <view class="cell-text">{{ detail.maxScoreTotal }}</view>
</view> </view>
</view> </view>
<view class="activity-cell"> <view class="activity-cell">
<view class="cell-label">有效期</view> <view class="cell-label">有效期</view>
<view class="cell-content"> 2024-12-12 12:12:12 </view> <view class="cell-content"> {{ getTimeRange(detail.startTime, detail.endTime) }} </view>
</view> </view>
<view class="activity-cell"> <view class="activity-cell">
<view class="cell-label">规则说明</view> <view class="cell-label">规则说明</view>
<view class="cell-content"> 每转发并邀请1人成功注册并登录获得10积久300 </view> <view class="cell-content"> {{ locale === 'zh' ? detail.descZh : detail.descEn }} </view>
</view> </view>
</view> </view>
</view> </view>
...@@ -44,6 +49,48 @@ import dHeader from '../../components/dHeader/index.vue' ...@@ -44,6 +49,48 @@ import dHeader from '../../components/dHeader/index.vue'
export default { export default {
components: { components: {
dHeader dHeader
},
data() {
return {
id: null,
detail: {}
}
},
onLoad(route) {
console.log(route)
this.id = route.id
this.getDetail()
},
computed: {
locale() {
return this.$lang.locale
}
},
methods: {
// 获取详情
getDetail() {
this.$request
.post('/app-api/member/score-rule/get', { id: this.id })
.then(({ code, data }) => {
if (code === 0 && data) {
this.detail = data
}
})
},
// 时间范围返回
getTimeRange(start, end) {
const formatDate = (timestamp) => {
const date = new Date(timestamp)
const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
const hours = String(date.getHours()).padStart(2, '0')
const minutes = String(date.getMinutes()).padStart(2, '0')
const seconds = String(date.getSeconds()).padStart(2, '0')
return `${year}:${month}:${day} ${hours}:${minutes}:${seconds}`
}
return `${formatDate(start)}${formatDate(end)}`
}
} }
} }
</script> </script>
......
...@@ -7,65 +7,73 @@ ...@@ -7,65 +7,73 @@
<image class="img" src="../../static/img/exchange.png"></image> <image class="img" src="../../static/img/exchange.png"></image>
</div> </div>
<div class="header-content"> <div class="header-content">
<div class="header-content-title">兑换完成</div> <div class="header-content-title">
{{ locale === 'zh' ? detail.statusZh : detail.statusEn }}
</div>
<div class="header-content-text"> <div class="header-content-text">
<view class="header-content-small">共计</view>90积分 <view class="header-content-small">共计</view>{{ detail.totalCount }}积分
</div> </div>
</div> </div>
</div> </div>
<div class="nav"> <div class="nav">
<div class="nav-image"> <div class="nav-image">
<image class="img" src="../../static/img/exchange.png"></image> <image class="img" :src="locale === 'zh' ? detail.imgZh : detail.imgEn"></image>
</div> </div>
<div class="nav-content"> <div class="nav-content">
<div class="nav-content-text">小米官旗米家体脂秤S400智能精准减肥电子称</div> <div class="nav-content-text">
{{ locale === 'zh' ? detail.rewardTitleZh : detail.rewardTitleEn }}
</div>
<div class="nav-content-tag"> <div class="nav-content-tag">
<div class="tag-image"> <div class="tag-image">
<image class="img" src="../../static/img/score_b.png"></image>10 <image class="img" src="../../static/img/score_b.png"></image
>{{ detail.oncePointsRequire }}
</div> </div>
<view class="tag-text">9</view> <view class="tag-text">{{ detail.rewardCount }}</view>
</div> </div>
</div> </div>
</div> </div>
<div class="main"> <div class="main">
<div class="main-cell"> <div class="main-cell">
<div class="cell-label">活动时间</div> <div class="cell-label">活动时间</div>
<div class="cell-content">2023-10-1至2024-11-01</div> <div class="cell-content">{{ getTimeRange(detail.startTime, detail.endTime) }}</div>
</div> </div>
<div class="main-cell"> <div class="main-cell">
<div class="cell-label">活动网点</div> <div class="cell-label">活动网点</div>
<div class="cell-content">中国大连中央大道店黄河路50号</div> <div class="cell-content">
</div> {{ locale === 'zh' ? detail.nodeTitleZh : detail.nodeTitleEn }}
<div class="main-cell"> </div>
<div class="cell-label">兑换方式</div>
<div class="cell-content">邮寄到家</div>
</div> </div>
<div class="main-cell"> <div class="main-cell">
<div class="cell-label">兑换方式</div> <div class="cell-label">兑换方式</div>
<div class="cell-content">邮寄到家</div>
</div>
<div class="main-cell">
<div class="cell-label">收货地址</div>
<div class="cell-content"> <div class="cell-content">
孟佳程,+23583273669137中国 大连 中央大道黄河路50号 {{ locale === 'zh' ? detail.redeemTypeZh : detail.redeemTypeEn }}
<view class="red">地址提交后无法修改,如需修改地址请联系客服</view>
</div> </div>
</div> </div>
<div class="main-cell"> <template v-if="detail.redeemType != 1">
<div class="cell-label">快递单号</div> <div class="main-cell">
<div class="cell-content">SFSF88997261500218</div> <div class="cell-label">收货地址</div>
</div> <div class="cell-content">
<div class="main-cell"> {{ detail.recipientName }}&ensp;+{{ detail.recipientPhoneNum }},
<div class="cell-label">快递公司</div> {{ detail.recipientAddress }}
<div class="cell-content">顺丰快递</div> <view class="red">地址提交后无法修改,如需修改地址请联系客服</view>
</div> </div>
<div class="main-cell"> </div>
<div class="cell-label">快递日期</div> <div class="main-cell">
<div class="cell-content">2024-01-01</div> <div class="cell-label">快递单号</div>
</div> <div class="cell-content">{{ detail.expressNo }}</div>
</div>
<div class="main-cell">
<div class="cell-label">快递公司</div>
<div class="cell-content">{{ detail.courierCompanyName }}</div>
</div>
<div class="main-cell">
<div class="cell-label">快递日期</div>
<div class="cell-content">{{ formatDate(detail.expressDate) }}</div>
</div>
</template>
<div class="main-cell"> <div class="main-cell">
<div class="cell-label">备注</div> <div class="cell-label">备注</div>
<div class="cell-content">请尽快发货</div> <div class="cell-content">{{ detail.remark }}</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -77,6 +85,55 @@ import dHeader from '../../components/dHeader/index.vue' ...@@ -77,6 +85,55 @@ import dHeader from '../../components/dHeader/index.vue'
export default { export default {
components: { components: {
dHeader dHeader
},
data() {
return {
id: null,
detail: {}
}
},
onLoad(route) {
console.log(route)
this.id = route.id
this.getDetail()
},
computed: {
locale() {
return this.$lang.locale
}
},
methods: {
// 获取详情
getDetail() {
this.$request
.post('/app-api/reward/redeem/record/detail', {
redeemId: this.id
})
.then(({ code, data }) => {
if (code == 0 && data) {
this.detail = data
}
})
.catch((error) => {
console.log(error)
})
},
// 时间范围返回
getTimeRange(start, end) {
return `${this.formatDate(start)}${this.formatDate(end)}`
},
// 时间戳转换为YYYY-MM-DD HH:mm:ss
formatDate(timestamp) {
if (!timestamp) return ''
const date = new Date(timestamp)
const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
const hours = String(date.getHours()).padStart(2, '0')
const minutes = String(date.getMinutes()).padStart(2, '0')
const seconds = String(date.getSeconds()).padStart(2, '0')
return `${year}:${month}:${day} ${hours}:${minutes}:${seconds}`
}
} }
} }
</script> </script>
...@@ -164,8 +221,8 @@ page { ...@@ -164,8 +221,8 @@ page {
color: var(--cb7b); color: var(--cb7b);
} }
.nav-content-tag { .nav-content-tag {
margin-top: auto;
width: 100%; width: 100%;
margin-top: 20upx;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
......
...@@ -3,37 +3,46 @@ ...@@ -3,37 +3,46 @@
<view class="gift-remark">不同网点兑换积分不同</view> <view class="gift-remark">不同网点兑换积分不同</view>
<view class="gift-select"> <view class="gift-select">
<view class="select-list"> <view class="select-list">
<view class="list-item" <view class="list-item" v-for="(item, index) in netList" :key="index"
>{{ locale == 'zh' ? userInfo.countryTitleZh : userInfo.countryTitleEn }} >{{ item }}
<uni-icons class="list-icon" type="right" color="#B3B3B3" size="12"></uni-icons>
</view>
<view class="list-item"
>{{ locale == 'zh' ? userInfo.cityTitleZh : userInfo.cityTitleEn }}
<uni-icons class="list-icon" type="right" color="#B3B3B3" size="12"></uni-icons> <uni-icons class="list-icon" type="right" color="#B3B3B3" size="12"></uni-icons>
</view> </view>
</view> </view>
<view class="select-right"> <view class="select-right">
请选择网点 <picker
<uni-icons class="list-icon" type="right" color="#B3B3B3" size="12"></uni-icons> mode="multiSelector"
:range="pickerData"
:value="pickerValue"
:range-key="locale === 'zh' ? 'labelZh' : 'labelEn'"
@change="bindPickerChange"
@columnchange="bindColumnChange"
>
请选择网点
<uni-icons class="list-icon" type="right" color="#B3B3B3" size="12"></uni-icons>
</picker>
</view> </view>
</view> </view>
<view class="gift-content"> <view class="gift-content">
<view class="gift-item" v-for="item in 7" :key="item" @click="toMail"> <view class="gift-item" v-for="item in giftList" :key="item.id" @click="toMail(item.id)">
<view class="gift-image-box"> <view class="gift-image-box">
<image class="gift-image" mode="cover" src="../../../static/img/wallet.png"></image> <image
class="gift-image"
mode="cover"
:src="locale == 'zh' ? item.imgZh : item.imgEn"
></image>
<view class="gift-tag"> <view class="gift-tag">
<view class="tags"> <view class="tags">
<image class="tag-image" src="../../../static/img/score.png"></image> <image class="tag-image" src="../../../static/img/score.png"></image>
<view class="tag-text">{{ item }}</view> <view class="tag-text">{{ item.pointsRequire }}</view>
</view> </view>
</view> </view>
<view class="foot-tag">剩余99</view> <view class="foot-tag">剩余{{ item.quantityRemain }}</view>
</view> </view>
<view class="gift-name">商品名称</view> <view class="gift-name">{{ locale === 'zh' ? item.titleZh : item.titleEn }}</view>
<view class="gift-menu"> <view class="gift-menu">
<view class="gift-menu-text">包邮</view> <view class="gift-menu-text" v-for="ele in item.pickMethodList" :key="ele.id">{{
<view class="gift-menu-text">到付</view> locale === 'zh' ? ele.labelZh : ele.labelEn
<view class="gift-menu-text">自提</view> }}</view>
</view> </view>
</view> </view>
</view> </view>
...@@ -49,18 +58,122 @@ export default { ...@@ -49,18 +58,122 @@ export default {
} }
}, },
data() { data() {
return {} return {
giftList: [],
data: [],
pickerData: [[], [], []],
pickerValue: [0, 0, 0],
nodeId: null,
netList: []
}
}, },
computed: { computed: {
locale() { locale() {
return this.$lang.locale == 'zh' ? 'zh' : 'en' return this.$lang.locale
} }
}, },
watch: {
userInfo: {
handler(val) {
console.log(val)
this.netList =
this.$lang.locale === 'zh'
? [val.countryTitleZh, val.cityTitleZh]
: [val.countryTitleEn, val.cityTitleEn]
},
immediate: true
}
},
created() {
this.getGift()
this.getNet()
},
methods: { methods: {
toMail() { toMail(id) {
uni.navigateTo({ uni.navigateTo({
url: '/pages/order_mail/order_mail' url: '/pages/order_mail/order_mail?id=' + id
}) })
},
// 获取礼品列表
async getGift() {
try {
const memberId = this.$store.getters.id
const { code, data } = await this.$request.post('/app-api/ecw/reward/list', {
memberId,
nodeId: this.nodeId
})
if (code === 0) {
this.giftList = data
}
} catch (error) {
console.log(error)
}
},
// 获取网点列表
async getNet() {
try {
const { code, data } = await this.$request.get('/admin-api/ecw/node/get-node-tree-region')
if (code === 0) {
this.data = data
this.initPickerData()
}
} catch (error) {
console.log(error)
}
},
// 初始化选择器数据
initPickerData() {
if (this.data.length === 0) return
const countries = this.data
const cities = this.data[0].children || []
const areas = (this.data[0].children && this.data[0].children[0].children) || []
this.pickerData[0] = countries
this.pickerData[1] = cities
this.pickerData[2] = areas
},
// 选择改变
bindPickerChange(e) {
const val = e.detail.value
this.pickerValue = val
this.nodeId = this.pickerData[2][val[2]].id
this.getGift()
this.getPickerValue(val)
},
// 列改变
bindColumnChange(e) {
const { column, value } = e.detail
const data = {
pickerData: this.pickerData,
pickerValue: this.pickerValue
}
data.pickerValue[column] = value
if (column === 0) {
const selectedCountry = this.data[value]
const cities = selectedCountry.children || []
const areas = (cities[0] && cities[0].children) || []
data.pickerData[1] = cities
data.pickerData[2] = areas
data.pickerValue[1] = 0
data.pickerValue[2] = 0
} else if (column === 1) {
const selectedCountry = this.data[data.pickerValue[0]]
const selectedCity = selectedCountry.children[value]
const areas = selectedCity.children || []
data.pickerData[2] = areas
data.pickerValue[2] = 0
}
this.pickerData = data.pickerData
this.pickerValue = data.pickerValue
},
// 选择数据显示
getPickerValue(val) {
const countries = this.pickerData[0][val[0]]
const cities = this.pickerData[1][val[1]]
const areas = this.pickerData[2][val[2]]
this.netList =
this.locale === 'zh'
? [countries.labelZh, cities.labelZh, areas.labelZh]
: [countries.labelEn, cities.labelEn, areas.labelEn]
} }
} }
} }
...@@ -150,8 +263,11 @@ export default { ...@@ -150,8 +263,11 @@ export default {
align-items: center; align-items: center;
} }
.gift-menu { .gift-menu {
margin-bottom: 20upx;
display: flex; display: flex;
height: 58upx; gap: 10upx;
flex-wrap: wrap;
min-height: 58upx;
font-size: 20upx; font-size: 20upx;
color: #b3b3b3; color: #b3b3b3;
align-items: center; align-items: center;
...@@ -178,8 +294,10 @@ export default { ...@@ -178,8 +294,10 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
width: 80upx; padding: 0 8upx;
min-width: 80upx;
height: 32upx; height: 32upx;
box-sizing: border-box;
background: linear-gradient(#ef7e1a, #f1b009); background: linear-gradient(#ef7e1a, #f1b009);
transform: skewX(15deg); transform: skewX(15deg);
border-top-right-radius: 10upx; border-top-right-radius: 10upx;
......
<template> <template>
<view class="int"> <view class="int">
<view class="int-content" v-for="item in 6" :key="item" @click="toDetail"> <view
class="int-content"
v-for="item in activityList"
:key="item.id"
@click="toDetail(item.id)"
>
<view class="int-content-left"> <view class="int-content-left">
<view class="content-tag"> <view class="content-tag">
<view class="tag-text">APP注册</view> <view class="tag-text">{{ locale === 'zh' ? item.typeZh : item.typeEn }}</view>
</view> </view>
<image class="content-image" src="../../../static/img/company.png"></image> <image
class="content-image"
:src="locale === 'zh' ? item.coverImageZh : item.coverImageEn"
></image>
</view> </view>
<view class="int-content-right"> <view class="int-content-right">
<view class="content-title">此处是活动标题</view> <view class="content-title">{{ locale === 'zh' ? item.titleZh : item.titleEn }}</view>
<view class="content-text" <view class="content-text">{{ locale === 'zh' ? item.descZh : item.descEn }}</view>
>此处是活动内容,此处是活动内容,此处是活动内容,此处是活动内容,此处是活动内容,此处是活动内容,此处是活动内容,</view
>
</view> </view>
</view> </view>
</view> </view>
...@@ -19,11 +25,35 @@ ...@@ -19,11 +25,35 @@
<script> <script>
export default { export default {
data() {
return {
activityList: []
}
},
created() {
this.getActivityList()
},
computed: {
locale() {
return this.$lang.locale
}
},
methods: { methods: {
toDetail() { toDetail(id) {
uni.navigateTo({ uni.navigateTo({
url: '/pages/activity_detail/activity_detail' url: '/pages/activity_detail/activity_detail?id=' + id
}) })
},
// 获取活动列表
getActivityList() {
this.$request
.post('/app-api/member/score-rule/list', { platform: 2 })
.then(({ code, data }) => {
// console.log(res)
if (code == 0 && data) {
this.activityList = data
}
})
} }
} }
} }
......
...@@ -38,8 +38,8 @@ ...@@ -38,8 +38,8 @@
> >
</view> </view>
<view class="main-content"> <view class="main-content">
<gift v-if="navIndex === 0" :userInfo="userInfo"></gift> <gift v-show="navIndex === 0" :userInfo="userInfo"></gift>
<points v-if="navIndex === 1"></points> <points v-show="navIndex === 1"></points>
</view> </view>
</view> </view>
</view> </view>
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
<view> <view>
<dHeader :title="'兑换日志'"></dHeader> <dHeader :title="'兑换日志'"></dHeader>
<view class="container"> <view class="container">
<view class="item" v-for="item in 6" :key="item" @click="toDetail"> <view class="item" v-for="item in list" :key="item.id" @click="toDetail(item.id)">
<div class="item-title">订单V值</div> <div class="item-title">兑换礼品</div>
<div class="item-box"> <div class="item-box">
<div class="box-img"> <div class="box-img">
<image <image
...@@ -13,13 +13,13 @@ ...@@ -13,13 +13,13 @@
</div> </div>
<div class="box-content"> <div class="box-content">
<div class="content-text"> <div class="content-text">
购买/充值满1000元即可赠送50积 分,满2000元送80积分不可看加满2000元送80积分 {{ locale === 'zh' ? item.rewardTitleZh : item.rewardTitleEn }}
</div> </div>
<div class="content-time">2024-01-01 11:11:11</div> <div class="content-time">{{ formatDate(item.createTime) }}</div>
</div> </div>
<div class="box-right"> <div class="box-right">
<view class="box-right-num">X1</view> <view class="box-right-num">X{{ item.rewardCount }}</view>
<view class="box-right-text">+50</view> <view class="box-right-text">-{{ item.scoreCount }}</view>
</div> </div>
</div> </div>
</view> </view>
...@@ -33,11 +33,49 @@ export default { ...@@ -33,11 +33,49 @@ export default {
components: { components: {
dHeader dHeader
}, },
data() {
return {
list: []
}
},
created() {
this.getList()
},
computed: {
locale() {
return this.$lang.locale
}
},
methods: { methods: {
toDetail() { toDetail(id) {
uni.navigateTo({ uni.navigateTo({
url: '/pages/exchange_detail/exchange_detail' url: '/pages/exchange_detail/exchange_detail?id=' + id
}) })
},
// 获取礼品列表
async getList() {
try {
const memberId = this.$store.getters.id
const { code, data } = await this.$request.post('/app-api/reward/redeem/record/list', {
memberId: 68
})
if (code == 0 && data) {
this.list = data
}
} catch (error) {
console.log(error)
}
},
// 时间戳转换为YYYY-MM-DD HH:mm:ss
formatDate(time) {
const date = new Date(time)
const Y = date.getFullYear() + '-'
const M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'
const D = date.getDate() + ' '
const h = date.getHours() + ':'
const m = date.getMinutes() + ':'
const s = date.getSeconds()
return Y + M + D + h + m + s
} }
} }
} }
......
...@@ -53,8 +53,9 @@ export default { ...@@ -53,8 +53,9 @@ export default {
// 获取列表 // 获取列表
async getList() { async getList() {
try { try {
const id = this.$store.getters.id
const { code, data } = await this.$request.post('/app-api/member/user-score/log', { const { code, data } = await this.$request.post('/app-api/member/user-score/log', {
id: 68 id
}) })
if (code == 0 && data) { if (code == 0 && data) {
this.list = data this.list = data
......
...@@ -3,36 +3,41 @@ ...@@ -3,36 +3,41 @@
<dHeader :title="'确定订单'"></dHeader> <dHeader :title="'确定订单'"></dHeader>
<view class="container"> <view class="container">
<view class="header"> <view class="header">
<view class="header-item" @click="menuChange(item)" v-for="item in menu" :key="item.id"> <view
<text class="header-text" :class="{ 'header-active': item.id == current }"> class="header-item"
{{ item.text }} @click="menuChange(item.value)"
v-for="item in menu"
:key="item.value"
>
<text class="header-text" :class="{ 'header-active': item.value == current }">
{{ locale === 'zh' ? item.labelZh : item.labelEn }}
</text> </text>
</view> </view>
</view> </view>
<!-- <view class="address"> <view class="address" v-if="current != 1" @click="bindPopup">
<view class="address-image"> <view class="address-image">
<image class="img" src="../../static/img/site_address.png"></image> <image class="img" src="../../static/img/site_address.png"></image>
</view> </view>
<view class="address-content"> <view class="address-content">
<view class="content-text"> <view class="content-text">
美国蒙大拿州中山路朱诺小区911号楼4单元朱诺小区911号楼4单元401 {{ showAddress.address }}
</view> </view>
<view class="content-info"> <view class="content-info">
<view class="info-name">张三</view> <view class="info-name">{{ showAddress.name }}</view>
<view class="info-phone">+86 13888888888</view> <view class="info-phone">+{{ showAddress.areaCode }}&ensp;{{ showAddress.phone }}</view>
</view> </view>
</view> </view>
<view class="address-icon"> <view class="address-icon">
<uni-icons type="right" color="#B7B7B7" size="20"></uni-icons> <uni-icons type="right" color="#B7B7B7" size="20"></uni-icons>
</view> </view>
</view> --> </view>
<view class="address"> <view class="address" v-else>
<view class="address-image"> <view class="address-image">
<image class="img" src="../../static/img/site_address.png"></image> <image class="img" src="../../static/img/site_address.png"></image>
</view> </view>
<view class="address-content address-content2"> <view class="address-content address-content2">
<view class="content-text"> <view class="content-text">
美国蒙大拿州中山路朱诺小区911号楼4单元朱诺小区911号楼4单元401 {{ locale === 'zh' ? orderInfo.nodeZh : orderInfo.nodeEn }}
</view> </view>
</view> </view>
</view> </view>
...@@ -40,13 +45,22 @@ ...@@ -40,13 +45,22 @@
<view class="main-gift"> <view class="main-gift">
<view class="gift"> <view class="gift">
<view class="gift-image"> <view class="gift-image">
<image class="img" src="../../static/img/site_address.png"></image> <image class="img" :src="locale === 'zh' ? orderInfo.imgZh : orderInfo.imgEn"></image>
<view class="gift-tag">
<view class="tags">
<image class="tag-image" src="../../static/img/score.png"></image>
<view class="tag-text">{{ orderInfo.pointsRequire }}</view>
</view>
</view>
<view class="foot-tag">剩余{{ orderInfo.quantityRemain }}</view>
</view> </view>
<view class="gift-content"> <view class="gift-content">
<view class="gift-content-text">小米官旗米家体脂秤S400智能精准减肥电子称</view> <view class="gift-content-text">{{
locale === 'zh' ? orderInfo.titleZh : orderInfo.titleEn
}}</view>
<view class="gift-cell"> <view class="gift-cell">
<view class="cell-label">兑换方式</view> <view class="cell-label">兑换方式</view>
<view class="cell-text">上门领取/包邮到家/邮寄到付</view> <view class="cell-text">{{ handExchangeText(orderInfo.pickMethodList) }}</view>
</view> </view>
<view class="gift-cell"> <view class="gift-cell">
<view class="cell-label">活动时间</view> <view class="cell-label">活动时间</view>
...@@ -55,12 +69,14 @@ ...@@ -55,12 +69,14 @@
</view> </view>
</view> </view>
<view class="main-count"> <view class="main-count">
<count v-model="num"></count> <count v-model="num" :max="orderInfo.quantityRemain"></count>
</view> </view>
</view> </view>
<view class="main-footer"> <view class="main-footer">
<input class="inp" placeholder="请输入验证码" /> <input class="inp" placeholder="请输入验证码" v-model="code" />
<view class="btn" @click="handleCode">获取验证码</view> <view class="btn" @click="handleCode">{{
codeTime == 0 ? '获取验证码' : `${codeTime}s后可重新发送`
}}</view>
</view> </view>
</view> </view>
</view> </view>
...@@ -79,10 +95,39 @@ ...@@ -79,10 +95,39 @@
<view class="placeholder">最多输入100</view> <view class="placeholder">最多输入100</view>
</view> </view>
<view class="container-text"> <view class="container-text">
已选{{ num }}件,合计积分:<view class="container-num">{{ num * 10 }}</view 已选{{ num }}件,合计积分:<view class="container-num">{{ total }}</view
>积分 >积分
</view> </view>
<view class="container-btn">提交订单</view> <view class="container-btn" @click="bindSubmitOrder">提交订单</view>
<uni-popup ref="popup" type="bottom" border-radius="10px 10px 0 0" background-color="#fff">
<view class="popup-list">
<view
class="popup-list-item"
v-for="(item, index) in addressList"
:key="index"
:class="{ 'popup-list-item-active': addressId == item.id }"
>
<!-- <label @click="bindCheck($event, item)"
><radio class="radio" color="#ff4d4f" :checked="check == item.id" :value="item.name"
/></label> -->
<view class="popup-list-item-text" @click="bindAddress(item.id)">
<view class="item-text-address">{{ item.address }}</view>
<div class="item-text-content">
<view class="content-name">{{ item.name }}</view>
<div class="content-code">+{{ item.areaCode }}</div>
<view class="content-phone">{{ item.phone }}</view>
</div>
</view>
<view class="popup-list-item-edit" @click="toEditAddress(item.id)">
<image class="img" src="../../static/img/edit.png"></image>
</view>
</view>
</view>
<view class="popup-btn" @click="toAddressAdd">
<image class="img" src="../../static/img/address_add.png"></image>
<view class="text">新增收货地址</view>
</view>
</uni-popup>
</view> </view>
</template> </template>
...@@ -96,36 +141,213 @@ export default { ...@@ -96,36 +141,213 @@ export default {
}, },
data() { data() {
return { return {
menu: [ menu: [],
{ // 邮寄类型
id: 1, current: 0,
text: '包邮到家' // 数量
},
{
id: 2,
text: '邮寄到付'
},
{
id: 3,
text: '上门领取'
}
],
current: 1,
num: 1, num: 1,
remark: '' // 备注
remark: '',
// 礼品详细信息
orderInfo: {},
// 礼品id
id: null,
// 地址信息
addressList: [],
// 地址默认选中
check: 0,
// 展示地址
showAddress: {},
first: true,
// 地址id
addressId: null,
// 验证码
code: '',
// 验证码倒计时
codeTime: 0
}
},
onLoad(route) {
this.id = route.id
this.getOrder()
},
onShow() {
this.getAddress()
},
computed: {
locale() {
return this.$lang.locale
},
// 计算总积分
total() {
if (this.orderInfo.pointsRequire) {
return this.num * this.orderInfo.pointsRequire
}
return 0
} }
}, },
methods: { methods: {
menuChange(item) { // 送货类型切换
this.current = item.id menuChange(i) {
this.current = i
},
// 获取订单信息 礼品详情
async getOrder() {
try {
const { code, data } = await this.$request.get('/app-api/ecw/reward/get', {
id: this.id
})
if (code === 0 && data) {
console.log(data)
this.orderInfo = data
this.menu = data.pickMethodList
this.current = data.pickMethodList[0].value
}
} catch (error) {
console.log(error)
}
},
// 获取验证码
async handleCode() {
if (this.codeTime > 0) return
this.codeTime = 60
this.timer = setInterval(() => {
this.codeTime--
if (this.codeTime <= 0) {
clearInterval(this.timer)
}
}, 1000)
try {
const memberId = this.$store.getters.id
await this.$request.post('/app-api/reward/redeem/send-sms-code', {
memberId
})
} catch (error) {}
},
// 打开弹出层
bindPopup() {
this.$refs.popup.open()
},
// 获取地址列表
async getAddress() {
try {
const id = this.$store.getters.id
const { code, data } = await this.$request.get('/app-api/member/user-address/member/list', {
id
})
if (code !== 0) return
this.addressList = data
if (this.first) {
this.first = false
const defaultAddress = this.addressList.find((item) => item.isDefault === 0)
if (defaultAddress) {
this.check = defaultAddress.id
this.addressId = defaultAddress.id
} else {
this.showAddress = this.addressList[0]
this.addressId = this.addressList[0].id
}
}
this.addressChange()
} catch (error) {
console.error(error)
}
},
// 切换默认地址
async bindCheck(e, item) {
let that = this
that.check = item.id
try {
await that.$request.post('/app-api/member/user-address/update', {
...item,
isDefault: 0
})
} catch (err) {}
},
// 切换地址
bindAddress(id) {
this.addressId = id
this.addressChange()
},
// 地址信息更改
addressChange() {
const i = this.addressList.findIndex((item) => item.id === this.addressId)
if (i >= 0) this.showAddress = this.addressList[i]
this.$refs.popup.close()
},
// 新增地址
toAddressAdd() {
uni.navigateTo({
url: '/pages/address_add/address_add'
})
this.$refs.popup.close()
},
toEditAddress(id) {
uni.navigateTo({
url: '/pages/address_edit/address_edit?id=' + id
})
this.$refs.popup.close()
}, },
handleCode() { // 兑换类型返回
console.log('获取验证码') handExchangeText(list) {
if (!list) return ''
let str = ''
list.forEach((item) => {
str = this.locale === 'zh' ? item.labelZh : item.labelEn
str += '/'
})
str = str.slice(0, -1)
return str
},
// 提交订单
bindSubmitOrder() {
if (!this.code) {
uni.showToast({
title: '请输入验证码',
icon: 'none'
})
return
}
uni.showLoading({
title: '加载中'
})
this.submitOrder()
},
// 提交订单
async submitOrder() {
try {
const memberId = this.$store.getters.id
const params = {
memberId,
code: this.code,
entrance: 2,
recipientName: this.showAddress.name,
recipientAddress: this.showAddress.address,
recipientPhoneNum: this.showAddress.phone,
redeemType: this.current,
rewardCount: this.num,
rewardId: this.orderInfo.id,
remark: this.remark
}
const { code } = await this.$request.post('/app-api/reward/redeem/single', params)
if (code === 0) {
uni.reLaunch({
url: '/pages/index/index'
})
} else {
uni.showToast({
title: '积分不足',
icon: 'none'
})
}
} catch (error) {
console.log(error)
}
uni.hideLoading()
} }
} }
} }
</script> </script>
<style lang="scss"> <style lang="scss">
page { page {
/* #ifdef H5 */ /* #ifdef H5 */
...@@ -342,4 +564,134 @@ page { ...@@ -342,4 +564,134 @@ page {
background-color: #045fe7; background-color: #045fe7;
border-radius: 40upx; border-radius: 40upx;
} }
.popup-list {
margin: 30upx 0 20upx 0;
width: 100%;
min-height: 100upx;
max-height: 600upx;
overflow-y: scroll;
box-sizing: border-box;
.popup-list-item {
margin-bottom: 20upx;
padding: 20upx 30upx;
width: 100%;
display: flex;
align-items: center;
font-size: 24upx;
color: #333;
box-sizing: border-box;
}
.radio {
transform: scale(0.8);
margin-right: 10upx;
}
}
.popup-btn {
margin: auto;
margin-bottom: 40upx;
width: 70%;
height: 100upx;
display: flex;
align-items: center;
justify-content: center;
font-size: 28upx;
font-weight: 600;
background-color: #f0f0f0;
border-radius: 20upx;
.img {
width: 48upx;
height: 48upx;
object-fit: cover;
margin-right: 10upx;
}
}
.popup-list-item-text {
min-height: 80upx;
flex: 1;
display: flex;
font-size: 24upx;
color: #333;
flex-direction: column;
justify-content: space-between;
.item-text-address {
font-size: 24upx;
color: #333;
}
.item-text-content {
display: flex;
align-items: center;
color: var(--cb7b);
font-size: 24upx;
}
.content-code {
margin: 0 10upx;
}
}
.popup-list-item-edit {
width: 80upx;
display: flex;
align-items: center;
justify-content: center;
.img {
width: 40upx;
height: 40upx;
object-fit: cover;
}
}
.popup-list-item-active {
background-color: #f0f0f0;
}
.gift-tag {
position: absolute;
top: 0;
left: 0;
z-index: 9;
display: flex;
align-items: center;
justify-content: center;
padding: 0 8upx;
min-width: 80upx;
height: 32upx;
box-sizing: border-box;
background: linear-gradient(#ef7e1a, #f1b009);
transform: skewX(15deg);
border-top-right-radius: 10upx;
border-bottom-left-radius: 10upx;
.tag-image {
width: 24upx;
height: 24upx;
}
.tags {
display: flex;
align-items: center;
justify-content: center;
transform: skewX(-15deg);
}
.tag-text {
margin-left: 4upx;
font-weight: 500;
color: #fff;
font-size: 24upx;
}
}
.foot-tag {
position: absolute;
padding: 0 8upx;
bottom: 0;
right: 0;
z-index: 9;
display: flex;
align-items: center;
justify-content: center;
min-width: 110upx;
height: 32upx;
color: #fff;
font-size: 22upx;
box-sizing: border-box;
background: linear-gradient(#ef7e1a, #f1b009);
border-top-right-radius: 10upx;
border-bottom-left-radius: 10upx;
}
</style> </style>
## 1.9.1(2024-04-02)
- 修复 uni-popup-dialog vue3下使用value无法进行绑定的bug(双向绑定兼容旧写法)
## 1.9.0(2024-03-28)
- 修复 uni-popup-dialog 双向绑定时初始化逻辑修正
## 1.8.9(2024-03-20)
- 修复 uni-popup-dialog 数据输入时修正为双向绑定
## 1.8.8(2024-02-20)
- 修复 uni-popup 在微信小程序下出现文字向上闪动的bug
## 1.8.7(2024-02-02)
- 新增 uni-popup-dialog 新增属性focus:input模式下,是否自动自动聚焦
## 1.8.6(2024-01-30)
- 新增 uni-popup-dialog 新增属性maxLength:限制输入框字数
## 1.8.5(2024-01-26)
- 新增 uni-popup-dialog 新增属性showClose:控制关闭按钮的显示
## 1.8.4(2023-11-15)
- 新增 uni-popup 支持uni-app-x 注意暂时仅支持 `maskClick` `@open` `@close`
## 1.8.3(2023-04-17)
- 修复 uni-popup 重复打开时的 bug
## 1.8.2(2023-02-02)
- uni-popup-dialog 组件新增 inputType 属性
## 1.8.1(2022-12-01)
- 修复 nvue 下 v-show 报错
## 1.8.0(2022-11-29)
- 优化 主题样式
## 1.7.9(2022-04-02) ## 1.7.9(2022-04-02)
- 修复 弹出层内部无法滚动的bug - 修复 弹出层内部无法滚动的bug
## 1.7.8(2022-03-28) ## 1.7.8(2022-03-28)
......
...@@ -10,14 +10,15 @@ ...@@ -10,14 +10,15 @@
</view> </view>
<view v-else class="uni-dialog-content"> <view v-else class="uni-dialog-content">
<slot> <slot>
<input class="uni-dialog-input" v-model="val" type="text" :placeholder="placeholderText" :focus="focus" > <input class="uni-dialog-input" :maxlength="maxlength" v-model="val" :type="inputType"
:placeholder="placeholderText" :focus="focus">
</slot> </slot>
</view> </view>
<view class="uni-dialog-button-group"> <view class="uni-dialog-button-group">
<view class="uni-dialog-button" @click="closeDialog"> <view class="uni-dialog-button" v-if="showClose" @click="closeDialog">
<text class="uni-dialog-button-text">{{closeText}}</text> <text class="uni-dialog-button-text">{{closeText}}</text>
</view> </view>
<view class="uni-dialog-button uni-border-left" @click="onOk"> <view class="uni-dialog-button" :class="showClose?'uni-border-left':''" @click="onOk">
<text class="uni-dialog-button-text uni-button-color">{{okText}}</text> <text class="uni-dialog-button-text uni-button-color">{{okText}}</text>
</view> </view>
</view> </view>
...@@ -28,16 +29,19 @@ ...@@ -28,16 +29,19 @@
<script> <script>
import popup from '../uni-popup/popup.js' import popup from '../uni-popup/popup.js'
import { import {
initVueI18n initVueI18n
} from '@dcloudio/uni-i18n' } from '@dcloudio/uni-i18n'
import messages from '../uni-popup/i18n/index.js' import messages from '../uni-popup/i18n/index.js'
const { t } = initVueI18n(messages) const {
t
} = initVueI18n(messages)
/** /**
* PopUp 弹出层-对话框样式 * PopUp 弹出层-对话框样式
* @description 弹出层-对话框样式 * @description 弹出层-对话框样式
* @tutorial https://ext.dcloud.net.cn/plugin?id=329 * @tutorial https://ext.dcloud.net.cn/plugin?id=329
* @property {String} value input 模式下的默认值 * @property {String} value input 模式下的默认值
* @property {String} placeholder input 模式下输入提示 * @property {String} placeholder input 模式下输入提示
* @property {Boolean} focus input模式下是否自动聚焦,默认为true
* @property {String} type = [success|warning|info|error] 主题样式 * @property {String} type = [success|warning|info|error] 主题样式
* @value success 成功 * @value success 成功
* @value warning 提示 * @value warning 提示
...@@ -46,8 +50,10 @@ ...@@ -46,8 +50,10 @@
* @property {String} mode = [base|input] 模式、 * @property {String} mode = [base|input] 模式、
* @value base 基础对话框 * @value base 基础对话框
* @value input 可输入对话框 * @value input 可输入对话框
* @showClose {Boolean} 是否显示关闭按钮
* @property {String} content 对话框内容 * @property {String} content 对话框内容
* @property {Boolean} beforeClose 是否拦截取消事件 * @property {Boolean} beforeClose 是否拦截取消事件
* @property {Number} maxlength 输入
* @event {Function} confirm 点击确认按钮触发 * @event {Function} confirm 点击确认按钮触发
* @event {Function} close 点击取消按钮触发 * @event {Function} close 点击取消按钮触发
*/ */
...@@ -55,12 +61,30 @@ ...@@ -55,12 +61,30 @@
export default { export default {
name: "uniPopupDialog", name: "uniPopupDialog",
mixins: [popup], mixins: [popup],
emits:['confirm','close'], emits: ['confirm', 'close', 'update:modelValue', 'input'],
props: { props: {
inputType: {
type: String,
default: 'text'
},
showClose: {
type: Boolean,
default: true
},
// #ifdef VUE2
value: { value: {
type: [String, Number], type: [String, Number],
default: '' default: ''
}, },
// #endif
// #ifdef VUE3
modelValue: {
type: [Number, String],
default: ''
},
// #endif
placeholder: { placeholder: {
type: [String, Number], type: [String, Number],
default: '' default: ''
...@@ -85,19 +109,26 @@ ...@@ -85,19 +109,26 @@
type: Boolean, type: Boolean,
default: false default: false
}, },
cancelText:{ cancelText: {
type: String, type: String,
default: '' default: ''
}, },
confirmText:{ confirmText: {
type: String, type: String,
default: '' default: ''
},
maxlength: {
type: Number,
default: -1,
},
focus: {
type: Boolean,
default: true,
} }
}, },
data() { data() {
return { return {
dialogType: 'error', dialogType: 'error',
focus: false,
val: "" val: ""
} }
}, },
...@@ -125,7 +156,21 @@ ...@@ -125,7 +156,21 @@
} }
}, },
value(val) { value(val) {
this.val = val if (this.maxlength != -1 && this.mode === 'input') {
this.val = val.slice(0, this.maxlength);
} else {
this.val = val
}
},
val(val) {
// #ifdef VUE2
// TODO 兼容 vue2
this.$emit('input', val);
// #endif
// #ifdef VUE3
// TODO 兼容 vue3
this.$emit('update:modelValue', val);
// #endif
} }
}, },
created() { created() {
...@@ -134,25 +179,25 @@ ...@@ -134,25 +179,25 @@
// this.popup.closeMask() // this.popup.closeMask()
if (this.mode === 'input') { if (this.mode === 'input') {
this.dialogType = 'info' this.dialogType = 'info'
this.val = this.value this.val = this.value;
// #ifdef VUE3
this.val = this.modelValue;
// #endif
} else { } else {
this.dialogType = this.type this.dialogType = this.type
} }
}, },
mounted() {
this.focus = true
},
methods: { methods: {
/** /**
* 点击确认按钮 * 点击确认按钮
*/ */
onOk() { onOk() {
if (this.mode === 'input'){ if (this.mode === 'input') {
this.$emit('confirm', this.val) this.$emit('confirm', this.val)
}else{ } else {
this.$emit('confirm') this.$emit('confirm')
} }
if(this.beforeClose) return if (this.beforeClose) return
this.popup.close() this.popup.close()
}, },
/** /**
...@@ -160,17 +205,17 @@ ...@@ -160,17 +205,17 @@
*/ */
closeDialog() { closeDialog() {
this.$emit('close') this.$emit('close')
if(this.beforeClose) return if (this.beforeClose) return
this.popup.close() this.popup.close()
}, },
close(){ close() {
this.popup.close() this.popup.close()
} }
} }
} }
</script> </script>
<style lang="scss" > <style lang="scss">
.uni-popup-dialog { .uni-popup-dialog {
width: 300px; width: 300px;
border-radius: 11px; border-radius: 11px;
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
{ {
text: '支付宝', text: '支付宝',
icon: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/d684ae40-50be-11eb-8ff1-d5dcf8779628.png', icon: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/d684ae40-50be-11eb-8ff1-d5dcf8779628.png',
name: 'wx' name: 'ali'
}, },
{ {
text: 'QQ', text: 'QQ',
......
<template>
<view class="popup-root" v-if="isOpen" v-show="isShow" @click="clickMask">
<view @click.stop>
<slot></slot>
</view>
</view>
</template>
<script>
type CloseCallBack = ()=> void;
let closeCallBack:CloseCallBack = () :void => {};
export default {
emits:["close","clickMask"],
data() {
return {
isShow:false,
isOpen:false
}
},
props: {
maskClick: {
type: Boolean,
default: true
},
},
watch: {
// 设置show = true 时,如果没有 open 需要设置为 open
isShow:{
handler(isShow) {
// console.log("isShow",isShow)
if(isShow && this.isOpen == false){
this.isOpen = true
}
},
immediate:true
},
// 设置isOpen = true 时,如果没有 isShow 需要设置为 isShow
isOpen:{
handler(isOpen) {
// console.log("isOpen",isOpen)
if(isOpen && this.isShow == false){
this.isShow = true
}
},
immediate:true
}
},
methods:{
open(){
// ...funs : CloseCallBack[]
// if(funs.length > 0){
// closeCallBack = funs[0]
// }
this.isOpen = true;
},
clickMask(){
if(this.maskClick == true){
this.$emit('clickMask')
this.close()
}
},
close(): void{
this.isOpen = false;
this.$emit('close')
closeCallBack()
},
hiden(){
this.isShow = false
},
show(){
this.isShow = true
}
}
}
</script>
<style>
.popup-root {
position: fixed;
top: 0;
left: 0;
width: 750rpx;
height: 100%;
flex: 1;
background-color: rgba(0, 0, 0, 0.3);
justify-content: center;
align-items: center;
z-index: 99;
}
</style>
\ No newline at end of file
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
:duration="duration" :show="showTrans" @click="onTap" /> :duration="duration" :show="showTrans" @click="onTap" />
<uni-transition key="2" :mode-class="ani" name="content" :styles="transClass" :duration="duration" <uni-transition key="2" :mode-class="ani" name="content" :styles="transClass" :duration="duration"
:show="showTrans" @click="onTap"> :show="showTrans" @click="onTap">
<view class="uni-popup__wrapper" :style="{ backgroundColor: bg }" :class="[popupstyle]" @click="clear"> <view class="uni-popup__wrapper" :style="getStyles" :class="[popupstyle]" @click="clear">
<slot /> <slot />
</view> </view>
</uni-transition> </uni-transition>
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
* @property {Boolean} isMaskClick = [true|false] 蒙版点击是否关闭弹窗 * @property {Boolean} isMaskClick = [true|false] 蒙版点击是否关闭弹窗
* @property {String} backgroundColor 主窗口背景色 * @property {String} backgroundColor 主窗口背景色
* @property {String} maskBackgroundColor 蒙版颜色 * @property {String} maskBackgroundColor 蒙版颜色
* @property {String} borderRadius 设置圆角(左上、右上、右下和左下) 示例:"10px 10px 10px 10px"
* @property {Boolean} safeArea 是否适配底部安全区 * @property {Boolean} safeArea 是否适配底部安全区
* @event {Function} change 打开关闭弹窗触发,e={show: false} * @event {Function} change 打开关闭弹窗触发,e={show: false}
* @event {Function} maskClick 点击遮罩触发 * @event {Function} maskClick 点击遮罩触发
...@@ -86,6 +87,9 @@ ...@@ -86,6 +87,9 @@
type: String, type: String,
default: 'rgba(0, 0, 0, 0.4)' default: 'rgba(0, 0, 0, 0.4)'
}, },
borderRadius:{
type: String,
}
}, },
watch: { watch: {
...@@ -157,16 +161,25 @@ ...@@ -157,16 +161,25 @@
backgroundColor: 'rgba(0, 0, 0, 0.4)' backgroundColor: 'rgba(0, 0, 0, 0.4)'
}, },
transClass: { transClass: {
backgroundColor: 'transparent',
borderRadius: this.borderRadius || "0",
position: 'fixed', position: 'fixed',
left: 0, left: 0,
right: 0 right: 0
}, },
maskShow: true, maskShow: true,
mkclick: true, mkclick: true,
popupstyle: this.isDesktop ? 'fixforpc-top' : 'top' popupstyle: 'top'
} }
}, },
computed: { computed: {
getStyles() {
let res = { backgroundColor: this.bg };
if (this.borderRadius || "0") {
res = Object.assign(res, { borderRadius: this.borderRadius })
}
return res;
},
isDesktop() { isDesktop() {
return this.popupWidth >= 500 && this.popupHeight >= 500 return this.popupWidth >= 500 && this.popupHeight >= 500
}, },
...@@ -221,6 +234,12 @@ ...@@ -221,6 +234,12 @@
this.setH5Visible() this.setH5Visible()
}, },
// #endif // #endif
activated() {
this.setH5Visible(!this.showPopup);
},
deactivated() {
this.setH5Visible(true);
},
created() { created() {
// this.mkclick = this.isMaskClick || this.maskClick // this.mkclick = this.isMaskClick || this.maskClick
if (this.isMaskClick === null && this.maskClick === null) { if (this.isMaskClick === null && this.maskClick === null) {
...@@ -240,10 +259,10 @@ ...@@ -240,10 +259,10 @@
this.maskClass.backgroundColor = this.maskBackgroundColor this.maskClass.backgroundColor = this.maskBackgroundColor
}, },
methods: { methods: {
setH5Visible() { setH5Visible(visible = true) {
// #ifdef H5 // #ifdef H5
// fix by mehaotian 处理 h5 滚动穿透的问题 // fix by mehaotian 处理 h5 滚动穿透的问题
document.getElementsByTagName('body')[0].style.overflow = 'visible' document.getElementsByTagName('body')[0].style.overflow = visible ? "visible" : "hidden";
// #endif // #endif
}, },
/** /**
...@@ -269,8 +288,7 @@ ...@@ -269,8 +288,7 @@
open(direction) { open(direction) {
// fix by mehaotian 处理快速打开关闭的情况 // fix by mehaotian 处理快速打开关闭的情况
if (this.showPopup) { if (this.showPopup) {
clearTimeout(this.timer) return
this.showPopup = false
} }
let innerType = ['top', 'center', 'bottom', 'left', 'right', 'message', 'dialog', 'share'] let innerType = ['top', 'center', 'bottom', 'left', 'right', 'message', 'dialog', 'share']
if (!(direction && innerType.indexOf(direction) !== -1)) { if (!(direction && innerType.indexOf(direction) !== -1)) {
...@@ -324,7 +342,8 @@ ...@@ -324,7 +342,8 @@
position: 'fixed', position: 'fixed',
left: 0, left: 0,
right: 0, right: 0,
backgroundColor: this.bg backgroundColor: this.bg,
borderRadius:this.borderRadius || "0"
} }
// TODO 兼容 type 属性 ,后续会废弃 // TODO 兼容 type 属性 ,后续会废弃
if (type) return if (type) return
...@@ -348,7 +367,8 @@ ...@@ -348,7 +367,8 @@
right: 0, right: 0,
bottom: 0, bottom: 0,
paddingBottom: this.safeAreaInsets + 'px', paddingBottom: this.safeAreaInsets + 'px',
backgroundColor: this.bg backgroundColor: this.bg,
borderRadius:this.borderRadius || "0",
} }
// TODO 兼容 type 属性 ,后续会废弃 // TODO 兼容 type 属性 ,后续会废弃
if (type) return if (type) return
...@@ -360,7 +380,13 @@ ...@@ -360,7 +380,13 @@
*/ */
center(type) { center(type) {
this.popupstyle = 'center' this.popupstyle = 'center'
this.ani = ['zoom-out', 'fade'] //微信小程序下,组合动画会出现文字向上闪动问题,再此做特殊处理
// #ifdef MP-WEIXIN
this.ani = ['fade']
// #endif
// #ifndef MP-WEIXIN
this.ani = ['zoom-out', 'fade']
// #endif
this.transClass = { this.transClass = {
position: 'fixed', position: 'fixed',
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
...@@ -372,7 +398,8 @@ ...@@ -372,7 +398,8 @@
right: 0, right: 0,
top: 0, top: 0,
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center' alignItems: 'center',
borderRadius:this.borderRadius || "0"
} }
// TODO 兼容 type 属性 ,后续会废弃 // TODO 兼容 type 属性 ,后续会废弃
if (type) return if (type) return
...@@ -388,6 +415,7 @@ ...@@ -388,6 +415,7 @@
bottom: 0, bottom: 0,
top: 0, top: 0,
backgroundColor: this.bg, backgroundColor: this.bg,
borderRadius:this.borderRadius || "0",
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
display: 'flex', display: 'flex',
flexDirection: 'column' flexDirection: 'column'
...@@ -407,6 +435,7 @@ ...@@ -407,6 +435,7 @@
right: 0, right: 0,
top: 0, top: 0,
backgroundColor: this.bg, backgroundColor: this.bg,
borderRadius:this.borderRadius || "0",
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
display: 'flex', display: 'flex',
flexDirection: 'column' flexDirection: 'column'
......
{ {
"id": "uni-popup", "id": "uni-popup",
"displayName": "uni-popup 弹出层", "displayName": "uni-popup 弹出层",
"version": "1.7.9", "version": "1.9.1",
"description": " Popup 组件,提供常用的弹层", "description": " Popup 组件,提供常用的弹层",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
...@@ -17,12 +17,8 @@ ...@@ -17,12 +17,8 @@
"directories": { "directories": {
"example": "../../temps/example_temps" "example": "../../temps/example_temps"
}, },
"dcloudext": { "dcloudext": {
"category": [ "sale": {
"前端组件",
"通用组件"
],
"sale": {
"regular": { "regular": {
"price": "0.00" "price": "0.00"
}, },
...@@ -38,7 +34,8 @@ ...@@ -38,7 +34,8 @@
"data": "无", "data": "无",
"permissions": "无" "permissions": "无"
}, },
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
"type": "component-vue"
}, },
"uni_modules": { "uni_modules": {
"dependencies": [ "dependencies": [
...@@ -49,7 +46,8 @@ ...@@ -49,7 +46,8 @@
"platforms": { "platforms": {
"cloud": { "cloud": {
"tcb": "y", "tcb": "y",
"aliyun": "y" "aliyun": "y",
"alipay": "n"
}, },
"client": { "client": {
"App": { "App": {
......
## 1.3.3(2024-04-23)
- 修复 当元素会受变量影响自动隐藏的bug
## 1.3.2(2023-05-04)
- 修复 NVUE 平台报错的问题
## 1.3.1(2021-11-23) ## 1.3.1(2021-11-23)
- 修复 init 方法初始化问题 - 修复 init 方法初始化问题
## 1.3.0(2021-11-19) ## 1.3.0(2021-11-19)
......
...@@ -10,7 +10,10 @@ const nvueAnimation = uni.requireNativePlugin('animation') ...@@ -10,7 +10,10 @@ const nvueAnimation = uni.requireNativePlugin('animation')
class MPAnimation { class MPAnimation {
constructor(options, _this) { constructor(options, _this) {
this.options = options this.options = options
this.animation = uni.createAnimation(options) // 在iOS10+QQ小程序平台下,传给原生的对象一定是个普通对象而不是Proxy对象,否则会报parameter should be Object instead of ProxyObject的错误
this.animation = uni.createAnimation({
...options
})
this.currentStepAnimates = {} this.currentStepAnimates = {}
this.next = 0 this.next = 0
this.$ = _this this.$ = _this
......
<template> <template>
<view v-if="isShow" ref="ani" :animation="animationData" :class="customClass" :style="transformStyles" @click="onClick"><slot></slot></view> <!-- #ifndef APP-NVUE -->
<view v-show="isShow" ref="ani" :animation="animationData" :class="customClass" :style="transformStyles" @click="onClick"><slot></slot></view>
<!-- #endif -->
<!-- #ifdef APP-NVUE -->
<view v-if="isShow" ref="ani" :animation="animationData" :class="customClass" :style="transformStyles" @click="onClick"><slot></slot></view>
<!-- #endif -->
</template> </template>
<script> <script>
...@@ -48,7 +53,11 @@ export default { ...@@ -48,7 +53,11 @@ export default {
customClass:{ customClass:{
type: String, type: String,
default: '' default: ''
} },
onceRender:{
type:Boolean,
default:false
},
}, },
data() { data() {
return { return {
...@@ -245,7 +254,7 @@ export default { ...@@ -245,7 +254,7 @@ export default {
}, },
animationType(type) { animationType(type) {
return { return {
fade: type ? 1 : 0, fade: type ? 0 : 1,
'slide-top': `translateY(${type ? '0' : '-100%'})`, 'slide-top': `translateY(${type ? '0' : '-100%'})`,
'slide-right': `translateX(${type ? '0' : '100%'})`, 'slide-right': `translateX(${type ? '0' : '100%'})`,
'slide-bottom': `translateY(${type ? '0' : '100%'})`, 'slide-bottom': `translateY(${type ? '0' : '100%'})`,
......
{ {
"id": "uni-transition", "id": "uni-transition",
"displayName": "uni-transition 过渡动画", "displayName": "uni-transition 过渡动画",
"version": "1.3.1", "version": "1.3.3",
"description": "元素的简单过渡动画", "description": "元素的简单过渡动画",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
...@@ -17,11 +17,7 @@ ...@@ -17,11 +17,7 @@
"directories": { "directories": {
"example": "../../temps/example_temps" "example": "../../temps/example_temps"
}, },
"dcloudext": { "dcloudext": {
"category": [
"前端组件",
"通用组件"
],
"sale": { "sale": {
"regular": { "regular": {
"price": "0.00" "price": "0.00"
...@@ -38,7 +34,8 @@ ...@@ -38,7 +34,8 @@
"data": "无", "data": "无",
"permissions": "无" "permissions": "无"
}, },
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
"type": "component-vue"
}, },
"uni_modules": { "uni_modules": {
"dependencies": ["uni-scss"], "dependencies": ["uni-scss"],
...@@ -46,7 +43,8 @@ ...@@ -46,7 +43,8 @@
"platforms": { "platforms": {
"cloud": { "cloud": {
"tcb": "y", "tcb": "y",
"aliyun": "y" "aliyun": "y",
"alipay": "n"
}, },
"client": { "client": {
"App": { "App": {
......
import request from './request'
// 获取字典
export async function getDict(key) {
const params = {
dictType: key,
pageSize: 999,
pageNum: 1
}
try {
const { data } = await request.get('/admin-api/system/dict-data/page', { params })
return data
} catch (error) {
throw error;
}
}
// 返回字典值
export async function getDictLabel(dict, value, locale, key = 'value') {
const dictKeys = locale === 'zh' ? 'label' : 'labelEn';
const findLabel = (list) => {
const item = list.find(item => item[key] === value);
return item ? item[dictKeys] : '';
};
if (Array.isArray(dict)) {
return findLabel(dict);
} else if (typeof dict === 'string') {
try {
const { list } = await getDict(dict);
return findLabel(list);
} catch (error) {
throw error;
}
}
return '';
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment