h5手机端-福利选择:关闭h5手机端选择福利时的取货门店栏,限制收获地址在哈尔滨指定的辖区;
This commit is contained in:
@@ -73,7 +73,11 @@ public class WelfareAddressManageController {
|
|||||||
@ViReturn
|
@ViReturn
|
||||||
@RequiresPermissions("welfare.addressManage")
|
@RequiresPermissions("welfare.addressManage")
|
||||||
public Object doDefault(String id) {
|
public Object doDefault(String id) {
|
||||||
simpleService.dao().update(WelfareMemberAddress.class, Chain.make("isDefault", false), Cnd.where("userId", "=", ShiroUtil.getUserId()));
|
WelfareMemberAddress address = simpleService.dao().fetch(WelfareMemberAddress.class, id);
|
||||||
|
if (address == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
simpleService.dao().update(WelfareMemberAddress.class, Chain.make("isDefault", false), Cnd.where("userId", "=", address.getUserId()));
|
||||||
simpleService.dao().update(WelfareMemberAddress.class, Chain.make("isDefault", true), Cnd.where("id", "=", id));
|
simpleService.dao().update(WelfareMemberAddress.class, Chain.make("isDefault", true), Cnd.where("id", "=", id));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -288,8 +288,11 @@ layout("/mobile/platform.html"){
|
|||||||
v-model="selectAddressPopup">
|
v-model="selectAddressPopup">
|
||||||
<div style="height: 100%">
|
<div style="height: 100%">
|
||||||
<div style="font-size: 15px; font-weight: bold; text-align: center; padding-top: 16px">配送至</div>
|
<div style="font-size: 15px; font-weight: bold; text-align: center; padding-top: 16px">配送至</div>
|
||||||
|
<div style="padding: 8px 16px; color: #969799; font-size: 12px; line-height: 18px">
|
||||||
|
可配送辖区:哈尔滨市{{receiveAddressAreaText}}
|
||||||
|
</div>
|
||||||
<template v-if="addressList && addressList.length>0">
|
<template v-if="addressList && addressList.length>0">
|
||||||
<van-cell @click="addressClick(item);selectAddressPopup=false" clickable icon="location-o"
|
<van-cell @click="addressClick(item)" clickable icon="location-o"
|
||||||
v-for="item in addressList">
|
v-for="item in addressList">
|
||||||
<template #title>{{item.address}}</template>
|
<template #title>{{item.address}}</template>
|
||||||
<template #label>
|
<template #label>
|
||||||
@@ -454,10 +457,16 @@ layout("/mobile/platform.html"){
|
|||||||
|
|
||||||
clickUpOrDown: false,
|
clickUpOrDown: false,
|
||||||
mobile: "",
|
mobile: "",
|
||||||
totalIntegral: 0
|
totalIntegral: 0,
|
||||||
|
selectedAddressCity: null,
|
||||||
|
selectedAddressCounty: null,
|
||||||
|
receiveAddressAreaList: ["道里区", "南岗区", "道外区", "香坊区", "呼兰区", "松北区", "阿城区", "双城区", "平房区"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
receiveAddressAreaText() {
|
||||||
|
return this.receiveAddressAreaList.join("、")
|
||||||
|
},
|
||||||
sumSelectNum() {
|
sumSelectNum() {
|
||||||
if (this.projectInfo && this.projectInfo.welfareProjectSubjects) {
|
if (this.projectInfo && this.projectInfo.welfareProjectSubjects) {
|
||||||
return this.projectInfo.welfareProjectSubjects[0].options
|
return this.projectInfo.welfareProjectSubjects[0].options
|
||||||
@@ -573,10 +582,12 @@ layout("/mobile/platform.html"){
|
|||||||
}
|
}
|
||||||
await this.selectAddressList()
|
await this.selectAddressList()
|
||||||
if (this.addressList && this.addressList.length > 0) {
|
if (this.addressList && this.addressList.length > 0) {
|
||||||
const resp = this.addressList.find((v) => v.isDefault)
|
const resp = this.getDefaultAddress()
|
||||||
this.addressClick(resp)
|
this.addressClick(resp)
|
||||||
} else {
|
} else {
|
||||||
this.selectAddress = ""
|
this.selectAddress = ""
|
||||||
|
this.selectedAddressCity = null
|
||||||
|
this.selectedAddressCounty = null
|
||||||
}
|
}
|
||||||
this.selectAddressPopup = true
|
this.selectAddressPopup = true
|
||||||
})
|
})
|
||||||
@@ -648,9 +659,16 @@ layout("/mobile/platform.html"){
|
|||||||
}
|
}
|
||||||
this.confirmPopup = true
|
this.confirmPopup = true
|
||||||
|
|
||||||
//回显用户的地址
|
//回显用户的地址,没有选择记录时读取默认地址
|
||||||
if (this.projectInfo.provideMode === 3 && this.isSelect && this.userSelection) {
|
if (this.projectInfo.provideMode === 3) {
|
||||||
|
if (this.isSelect && this.userSelection) {
|
||||||
this.selectAddress = this.userSelection[0].receiveAddress
|
this.selectAddress = this.userSelection[0].receiveAddress
|
||||||
|
this.selectedAddressCity = this.getReceiveAddressCity(this.selectAddress)
|
||||||
|
this.selectedAddressCounty = this.getReceiveAddressCounty(this.selectAddress)
|
||||||
|
} else {
|
||||||
|
await this.selectAddressList()
|
||||||
|
this.addressClick(this.getDefaultAddress())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//回显用户签名
|
//回显用户签名
|
||||||
@@ -666,6 +684,9 @@ layout("/mobile/platform.html"){
|
|||||||
this.$modal.msg("请填写您的收货地址")
|
this.$modal.msg("请填写您的收货地址")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (!this.validateReceiveAddressArea()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (this.projectInfo.signMode === 2) {
|
if (this.projectInfo.signMode === 2) {
|
||||||
if (this.signData == null || this.signData === "") {
|
if (this.signData == null || this.signData === "") {
|
||||||
@@ -743,10 +764,58 @@ layout("/mobile/platform.html"){
|
|||||||
this.selectAddressPopup = true
|
this.selectAddressPopup = true
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getDefaultAddress() {
|
||||||
|
if (!this.addressList || this.addressList.length === 0) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
const defaultAddressList = this.addressList.filter((v) => v.isDefault === true || v.isDefault === 1 || v.isDefault === "1")
|
||||||
|
return defaultAddressList.length > 0 ? defaultAddressList[0] : null
|
||||||
|
},
|
||||||
|
|
||||||
|
isReceiveAddressArea(city, county) {
|
||||||
|
return city && city.trim() === "哈尔滨市" && county && this.receiveAddressAreaList.includes(county.trim())
|
||||||
|
},
|
||||||
|
|
||||||
|
getReceiveAddressCity(receiveAddress) {
|
||||||
|
if (!receiveAddress) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
return receiveAddress.includes("哈尔滨市") ? "哈尔滨市" : null
|
||||||
|
},
|
||||||
|
|
||||||
|
getReceiveAddressCounty(receiveAddress) {
|
||||||
|
if (!receiveAddress) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
return this.receiveAddressAreaList.find((county) => receiveAddress.includes("哈尔滨市" + county))
|
||||||
|
},
|
||||||
|
|
||||||
|
validateReceiveAddressArea() {
|
||||||
|
const city = this.selectedAddressCity || this.getReceiveAddressCity(this.selectAddress)
|
||||||
|
const county = this.selectedAddressCounty || this.getReceiveAddressCounty(this.selectAddress)
|
||||||
|
if (this.isReceiveAddressArea(city, county)) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
this.$modal.msg("收货地址仅支持哈尔滨市下辖9个市辖区:" + this.receiveAddressAreaText)
|
||||||
|
return false
|
||||||
|
},
|
||||||
|
|
||||||
//地址列表点击
|
//地址列表点击
|
||||||
addressClick(item) {
|
addressClick(item) {
|
||||||
|
if (!item) {
|
||||||
|
this.selectAddress = ""
|
||||||
|
this.selectedAddressCity = null
|
||||||
|
this.selectedAddressCounty = null
|
||||||
|
return
|
||||||
|
}
|
||||||
const {province, city, county, address, name, tel} = item
|
const {province, city, county, address, name, tel} = item
|
||||||
this.selectAddress = "收货地址:" + province + city + county + address + "," + "收件人:" + name + "," + "联系方式:" + tel
|
this.selectAddress = "收货地址:" + province + city + county + address + "," + "收件人:" + name + "," + "联系方式:" + tel
|
||||||
|
this.selectedAddressCity = city
|
||||||
|
this.selectedAddressCounty = county
|
||||||
|
if (!this.isReceiveAddressArea(city, county)) {
|
||||||
|
this.$modal.msg("该地址不在可配送辖区内,可配送辖区:哈尔滨市" + this.receiveAddressAreaText)
|
||||||
|
}
|
||||||
|
this.selectAddressPopup = false
|
||||||
},
|
},
|
||||||
|
|
||||||
async getProjectInfo() {
|
async getProjectInfo() {
|
||||||
|
|||||||
@@ -323,7 +323,7 @@ layout("/layouts/platform.html"){
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<span style="color: #ac3111">
|
<span style="color: #ac3111">
|
||||||
温馨提示:填写默认收货地址后,系统会自动选择默认地址;如未设置默认,请您在添加收货地址后在此下拉框进行选择
|
温馨提示:填写默认收货地址后,系统会自动选择默认地址;如未设置默认,请您在添加收货地址后在此下拉框进行选择。可配送辖区:哈尔滨市{{receiveAddressAreaText}}
|
||||||
</span>
|
</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@@ -461,6 +461,9 @@ layout("/layouts/platform.html"){
|
|||||||
addressList: [],
|
addressList: [],
|
||||||
descData: "",
|
descData: "",
|
||||||
descDialogVisible: false,
|
descDialogVisible: false,
|
||||||
|
selectedAddressCity: null,
|
||||||
|
selectedAddressCounty: null,
|
||||||
|
receiveAddressAreaList: ["道里区", "南岗区", "道外区", "香坊区", "呼兰区", "松北区", "阿城区", "双城区", "平房区"],
|
||||||
|
|
||||||
projectInfo: {},
|
projectInfo: {},
|
||||||
welfareSubject: {},
|
welfareSubject: {},
|
||||||
@@ -505,6 +508,9 @@ layout("/layouts/platform.html"){
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
receiveAddressAreaText() {
|
||||||
|
return this.receiveAddressAreaList.join("、")
|
||||||
|
},
|
||||||
sumSelectNum() {
|
sumSelectNum() {
|
||||||
if (this.projectInfo && this.projectInfo.welfareProjectSubjects) {
|
if (this.projectInfo && this.projectInfo.welfareProjectSubjects) {
|
||||||
return this.projectInfo.welfareProjectSubjects[0].options
|
return this.projectInfo.welfareProjectSubjects[0].options
|
||||||
@@ -596,14 +602,6 @@ layout("/layouts/platform.html"){
|
|||||||
},
|
},
|
||||||
//数量更改
|
//数量更改
|
||||||
numChange(value, option, optionIndex) {
|
numChange(value, option, optionIndex) {
|
||||||
this.$nextTick(() => {
|
|
||||||
// 查找+1按钮
|
|
||||||
const plusButton = document.querySelector(".el-input-number__increase")
|
|
||||||
// 添加点击事件监听器
|
|
||||||
plusButton.addEventListener("click", this.handlePlusButtonClick(value, option, optionIndex))
|
|
||||||
})
|
|
||||||
},
|
|
||||||
handlePlusButtonClick(value, option, optionIndex) {
|
|
||||||
const {
|
const {
|
||||||
isIntegralMode,
|
isIntegralMode,
|
||||||
isCheckBox,
|
isCheckBox,
|
||||||
@@ -612,11 +610,7 @@ layout("/layouts/platform.html"){
|
|||||||
} = this.projectInfo
|
} = this.projectInfo
|
||||||
//积分模式
|
//积分模式
|
||||||
if (isIntegralMode) {
|
if (isIntegralMode) {
|
||||||
let totalIntegral = 0
|
this.calcTotalIntegral()
|
||||||
this.projectInfo.welfareProjectSubjects[0].options.forEach(v => {
|
|
||||||
totalIntegral = totalIntegral + (v.integral * v.selectNum)
|
|
||||||
})
|
|
||||||
this.totalIntegral = totalIntegral
|
|
||||||
} else {
|
} else {
|
||||||
if (isCheckBox === "checkBox") {
|
if (isCheckBox === "checkBox") {
|
||||||
//判断是否支持单个多选
|
//判断是否支持单个多选
|
||||||
@@ -636,6 +630,13 @@ layout("/layouts/platform.html"){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
calcTotalIntegral() {
|
||||||
|
let totalIntegral = 0
|
||||||
|
this.projectInfo.welfareProjectSubjects[0].options.forEach(v => {
|
||||||
|
totalIntegral = totalIntegral + (v.integral * v.selectNum)
|
||||||
|
})
|
||||||
|
this.totalIntegral = totalIntegral
|
||||||
|
},
|
||||||
|
|
||||||
async getProjectInfo(id) {
|
async getProjectInfo(id) {
|
||||||
const resp = await $.get("/platform/welfare/common/findOne", {projectId: id})
|
const resp = await $.get("/platform/welfare/common/findOne", {projectId: id})
|
||||||
@@ -664,6 +665,11 @@ layout("/layouts/platform.html"){
|
|||||||
const address = this.addressOptions.find((a) => a.id === val)
|
const address = this.addressOptions.find((a) => a.id === val)
|
||||||
if (address) {
|
if (address) {
|
||||||
this.$set(this.formData, "receiveAddress", address.name)
|
this.$set(this.formData, "receiveAddress", address.name)
|
||||||
|
this.selectedAddressCity = address.city
|
||||||
|
this.selectedAddressCounty = address.county
|
||||||
|
if (!this.isReceiveAddressArea(address.city, address.county)) {
|
||||||
|
this.$message.warning("该地址不在可配送辖区内,可配送辖区:哈尔滨市" + this.receiveAddressAreaText)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
doChoose() {
|
doChoose() {
|
||||||
@@ -713,6 +719,9 @@ layout("/layouts/platform.html"){
|
|||||||
this.$message.warning("请填写收货地址")
|
this.$message.warning("请填写收货地址")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (!this.validateReceiveAddressArea()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (![1, 4].includes(this.projectInfo.signMode)) {
|
if (![1, 4].includes(this.projectInfo.signMode)) {
|
||||||
@@ -766,22 +775,45 @@ layout("/layouts/platform.html"){
|
|||||||
}
|
}
|
||||||
|
|
||||||
await this.getProjectInfo(row.id)
|
await this.getProjectInfo(row.id)
|
||||||
|
if (!this.addressOptions || this.addressOptions.length === 0) {
|
||||||
|
await this.selectUserAddress()
|
||||||
|
}
|
||||||
this.$set(this.formData, "userName", "${@shiro.getPrincipalProperty('username')}")
|
this.$set(this.formData, "userName", "${@shiro.getPrincipalProperty('username')}")
|
||||||
this.$set(this.formData, "tel", "${@shiro.getPrincipalProperty('mobile')}")
|
this.$set(this.formData, "tel", "${@shiro.getPrincipalProperty('mobile')}")
|
||||||
|
|
||||||
|
let receiveAddress = ""
|
||||||
|
let addressId = null
|
||||||
|
let addressCity = null
|
||||||
|
let addressCounty = null
|
||||||
//如果已选择
|
//如果已选择
|
||||||
if (row.isChoose > 0) {
|
if (row.isChoose > 0 && this.userSelection && this.userSelection.length > 0) {
|
||||||
this.$set(this.formData, "receiveAddress", this.userSelection[0].receiveAddress)
|
receiveAddress = this.userSelection[0].receiveAddress
|
||||||
this.$set(this.formData, "addressId", null)
|
const address = this.addressOptions.find((a) => a.name === receiveAddress)
|
||||||
|
if (address) {
|
||||||
|
addressId = address.id
|
||||||
|
addressCity = address.city
|
||||||
|
addressCounty = address.county
|
||||||
|
} else {
|
||||||
|
addressCity = this.getReceiveAddressCity(receiveAddress)
|
||||||
|
addressCounty = this.getReceiveAddressCounty(receiveAddress)
|
||||||
|
}
|
||||||
this.$set(this.formData, "sign", this.userSelection[0].userSign)
|
this.$set(this.formData, "sign", this.userSelection[0].userSign)
|
||||||
} else {
|
} else {
|
||||||
const address = this.addressOptions.find((a) => a.isDefault)
|
const address = this.getDefaultAddress()
|
||||||
if (address) {
|
if (address) {
|
||||||
this.$set(this.formData, "receiveAddress", address.name)
|
receiveAddress = address.name
|
||||||
this.$set(this.formData, "addressId", address.id)
|
addressId = address.id
|
||||||
|
addressCity = address.city
|
||||||
|
addressCounty = address.county
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.$refs.guava.edit()
|
this.$refs.guava.edit()
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$set(this.formData, "receiveAddress", receiveAddress)
|
||||||
|
this.$set(this.formData, "addressId", addressId)
|
||||||
|
this.selectedAddressCity = addressCity
|
||||||
|
this.selectedAddressCounty = addressCounty
|
||||||
|
})
|
||||||
},
|
},
|
||||||
//获取用户选择的数据
|
//获取用户选择的数据
|
||||||
async getUserSelection(projectId) {
|
async getUserSelection(projectId) {
|
||||||
@@ -802,26 +834,55 @@ layout("/layouts/platform.html"){
|
|||||||
this.$set(v, "receiveAddress", "")
|
this.$set(v, "receiveAddress", "")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
if (this.projectInfo.isIntegralMode) {
|
||||||
|
this.calcTotalIntegral()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
async getChoice() {
|
async getChoice() {
|
||||||
const resp = await $.get("/mobile/welfare/mine/isChoice", {projectId: this.projectInfo.id})
|
const resp = await $.get("/mobile/welfare/mine/isChoice", {projectId: this.projectInfo.id})
|
||||||
this.isChoice = resp.data
|
this.isChoice = resp.data
|
||||||
},
|
},
|
||||||
|
isDefaultAddress(address) {
|
||||||
|
return address && (address.isDefault === true || address.isDefault === 1 || address.isDefault === "1")
|
||||||
|
},
|
||||||
|
getDefaultAddress() {
|
||||||
|
if (!this.addressOptions || this.addressOptions.length === 0) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
return this.addressOptions.find((address) => this.isDefaultAddress(address))
|
||||||
|
},
|
||||||
|
isReceiveAddressArea(city, county) {
|
||||||
|
return city && city.trim() === "哈尔滨市" && county && this.receiveAddressAreaList.includes(county.trim())
|
||||||
|
},
|
||||||
|
getReceiveAddressCity(receiveAddress) {
|
||||||
|
if (!receiveAddress) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
return receiveAddress.includes("哈尔滨市") ? "哈尔滨市" : null
|
||||||
|
},
|
||||||
|
getReceiveAddressCounty(receiveAddress) {
|
||||||
|
if (!receiveAddress) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
return this.receiveAddressAreaList.find((county) => receiveAddress.includes("哈尔滨市" + county))
|
||||||
|
},
|
||||||
|
validateReceiveAddressArea() {
|
||||||
|
const city = this.selectedAddressCity || this.getReceiveAddressCity(this.formData.receiveAddress)
|
||||||
|
const county = this.selectedAddressCounty || this.getReceiveAddressCounty(this.formData.receiveAddress)
|
||||||
|
if (this.isReceiveAddressArea(city, county)) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
this.$message.warning("收货地址仅支持哈尔滨市下辖9个市辖区:" + this.receiveAddressAreaText)
|
||||||
|
return false
|
||||||
|
},
|
||||||
async selectUserAddress() {
|
async selectUserAddress() {
|
||||||
const resp = await $.get("/platform/welfare/addressManage/selectUserAddress")
|
const resp = await $.get("/platform/welfare/addressManage/selectUserAddress")
|
||||||
resp.data.map((r) => {
|
resp.data.map((r) => {
|
||||||
let defaultName = r.isDefault ? "默认地址" : ""
|
let defaultName = this.isDefaultAddress(r) ? "默认地址" : ""
|
||||||
r.defaultName = defaultName
|
r.defaultName = defaultName
|
||||||
r.name = "收货地址:" + r.province + r.city + r.county + r.addressDetail + ",收件人:" + r.userName + ",联系方式:" + r.tel
|
r.name = "收货地址:" + r.province + r.city + r.county + r.addressDetail + ",收件人:" + r.userName + ",联系方式:" + r.tel
|
||||||
})
|
})
|
||||||
this.addressOptions = resp.data
|
this.addressOptions = resp.data
|
||||||
this.$nextTick(() => {
|
|
||||||
const address = this.addressOptions.find((v) => v.isDefault)
|
|
||||||
if (address) {
|
|
||||||
this.$set(this.formData, "addressId", address.id)
|
|
||||||
this.$set(this.formData, "receiveAddress", address.name)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
// 获取供应商
|
// 获取供应商
|
||||||
async getShoppingType() {
|
async getShoppingType() {
|
||||||
|
|||||||
Reference in New Issue
Block a user