This commit is contained in:
Paidax
2024-12-26 13:48:24 +08:00
parent d6c4f48afc
commit a45b3d638a
5 changed files with 145 additions and 77 deletions
@@ -139,7 +139,11 @@ layout("/mobile/platform.html"){
right: 0;
transform: rotate(23deg);
z-index: 1;
}
}
.van-submit-bar__button {
width: 150px;
}
</style>
<div id="app" v-cloak>
@@ -274,7 +278,8 @@ layout("/mobile/platform.html"){
</van-submit-bar>
</template>
<van-popup :style="{ height: '70%' }" closeable position="bottom" safe-area-inset-bottom
<van-popup :style="{ height: '70%' }" closeable :close-on-click-overlay="false" position="bottom" safe-area-inset-bottom
v-model="selectAddressPopup">
<div style="height: 100%">
<div style="font-size: 16px;font-weight: bold;text-align: center;padding-top: 16px;">
@@ -287,10 +292,17 @@ layout("/mobile/platform.html"){
<span style="font-size: 15px">{{item.address}}</span>
</template>
<template #label>
<div style="font-size: 14px;line-height: 1.5rem">
<div>{{"地区:" + item.province + item.city + item.county}}</div>
<div>{{"收件人:" + item.name}}</div>
<div>{{"联系方式" + item.tel}}</div>
<div style="display: flex">
<div style="font-size: 14px;line-height: 1.5rem;width: 80%">
<div>{{"地区:" + item.province + item.city + item.county}}</div>
<div>{{"收件人" + item.name}}</div>
<div>{{"联系方式:" + item.tel}}</div>
</div>
<div style="width: 20%;display: flex;align-content: flex-end;flex-wrap: wrap;flex-direction: column;justify-content: space-around;">
<van-button @click="editAddress(item)" style="width: 80px;font-size: 14px" round type="info" size="small">编辑</van-button>
<van-button @click="deleteAddress(item)" style="width: 80px;font-size: 14px" round type="danger" size="small">删除</van-button>
</div>
</div>
</template>
</van-cell>
@@ -306,7 +318,6 @@ layout("/mobile/platform.html"){
</van-button>
</div>
</div>
</van-popup>
<van-popup :style="{ height: '100%',width: '100%'}" position="right" safe-area-inset-bottom
@@ -443,7 +454,7 @@ layout("/mobile/platform.html"){
if (overdueChoiceTimeEnd == null || overdueChoiceTimeEnd === '') {
if (now > moment(choiceTimeStart).valueOf() && now < moment(choiceTimeEnd).valueOf()) {
return {text: this.isSelect ? '确定修改' : '确定选择', disabled: false}
return {text: this.isSelect ? '选好了,下一步' : '选好了,下一步', disabled: false}
} else if (now > moment(choiceTimeEnd).valueOf()) {
return {text: '选择已结束', disabled: true}
} else if (now < moment(choiceTimeStart).valueOf()) {
@@ -453,12 +464,12 @@ layout("/mobile/platform.html"){
//已选择了不能再动了
if (this.isSelect) {
if (moment(this.selectTime).valueOf() > moment(choiceTimeEnd).valueOf() && now < moment(overdueChoiceTimeEnd).valueOf()) {
return {text: '确定修改', disabled: false}
return {text: '下一步', disabled: false}
}
return {text: '选择已结束', disabled: true}
} else {
if (now > moment(choiceTimeStart).valueOf() && now < moment(overdueChoiceTimeEnd).valueOf()) {
return {text: this.isSelect ? '确定修改' : '确定选择', disabled: false}
return {text: this.isSelect ? '选好了,下一步' : '选好了,下一步', disabled: false}
} else if (now > moment(overdueChoiceTimeEnd).valueOf()) {
return {text: '选择已结束', disabled: true}
} else if (now < moment(choiceTimeStart).valueOf()) {
@@ -477,6 +488,46 @@ layout("/mobile/platform.html"){
}
},
methods: {
editAddress(item) {
pjaxReplace('/mobile/welfare/mine/addressEdit?projectId=' + this.projectId + '&id=' + item.id)
window.sessionStorage.setItem('welfareProjectId', this.projectId)
const formData = {
projectInfo: this.projectInfo,
signData: this.signData || null
}
window.sessionStorage.setItem('welfareProjectSelectInfo' + "${@shiro.getPrincipalProperty('loginname')}", JSON.stringify(formData))
},
deleteAddress(item) {
this.selectAddressPopup = true
// 确认要删除该地址吗
this.$dialog.confirm({
title: '提示',
message: '确认要删除该地址吗'
}).then(async () => {
const loading = this.$toast.loading({
message: '删除中...',
forbidClick: true,
overlay: true,
duration: 0
})
const resp = await $.post('/mobile/welfare/mine/deleteAddress', {id: item.id})
loading.close()
if (resp.code === 0) {
this.$toast.success(resp.msg)
}
await this.selectAddressList()
if (this.addressList && this.addressList.length > 0) {
const resp = this.addressList.find(v=> v.isDefault)
this.addressClick(resp)
} else {
this.selectAddress = ''
}
this.selectAddressPopup = true
}).catch(() => {
this.selectAddressPopup = true
})
},
// top字体颜色
getRankColor(rank) {
switch(rank) {
@@ -602,6 +653,7 @@ layout("/mobile/platform.html"){
}
this.confirmPopup = false
await this.getProjectInfo()
window.location.reload()
},
//查看详情
@@ -640,6 +692,10 @@ layout("/mobile/platform.html"){
//地址列表点击
addressClick(item) {
if (item == null) {
this.selectAddress = null
return
}
const {province, city, county, address, name, tel} = item
this.selectAddress = "收货地址:" + province + city + county + address + "," + "收件人:" + name + "," + "联系方式:" + tel
},
@@ -662,12 +718,15 @@ layout("/mobile/platform.html"){
//回显用户选择的数据
echoUserSelection() {
let selectNum = 0;
this.projectInfo.welfareProjectSubjects[0].options.forEach(v => {
const option = this.userSelection.find(x => x.selectOptionId === v.id)
if (option) {
v.selectNum = option.selectNum
selectNum = Number(selectNum) + Number(v.selectNum)
}
})
this.selectNum = selectNum
},
},
created() {