Merge remote-tracking branch 'origin/main'
This commit is contained in:
+4
@@ -212,6 +212,8 @@ public class HealthCheckupSingleServiceImpl extends ViServiceImpl<HealthCheckupP
|
|||||||
""");
|
""");
|
||||||
// cnd.and("aus.groupId","=",project.getActivityGroupId());
|
// cnd.and("aus.groupId","=",project.getActivityGroupId());
|
||||||
sql.setVar("projectCnd", "AND u.id NOT IN ( SELECT selectUserId FROM `health_checkup_user_selection` WHERE projectId = '" + projectId + "' AND selectUserId IS NOT NULL )");
|
sql.setVar("projectCnd", "AND u.id NOT IN ( SELECT selectUserId FROM `health_checkup_user_selection` WHERE projectId = '" + projectId + "' AND selectUserId IS NOT NULL )");
|
||||||
|
cnd.and("aus.projectId", "=", projectId);
|
||||||
|
cnd.and("u.id", "is not", null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
|
if (Strings.isNotBlank(searchName) && Strings.isNotBlank(searchKeyword)) {
|
||||||
@@ -275,6 +277,8 @@ public class HealthCheckupSingleServiceImpl extends ViServiceImpl<HealthCheckupP
|
|||||||
""");
|
""");
|
||||||
// cnd.and("aus.groupId","=",project.getActivityGroupId());
|
// cnd.and("aus.groupId","=",project.getActivityGroupId());
|
||||||
sql.setVar("projectCnd", "AND u.id NOT IN ( SELECT selectUserId FROM `health_checkup_user_selection` WHERE projectId = '" + projectId + "' AND selectUserId IS NOT NULL )");
|
sql.setVar("projectCnd", "AND u.id NOT IN ( SELECT selectUserId FROM `health_checkup_user_selection` WHERE projectId = '" + projectId + "' AND selectUserId IS NOT NULL )");
|
||||||
|
cnd.and("aus.projectId", "=", projectId);
|
||||||
|
cnd.and("u.id", "is not", null);
|
||||||
cnd.asc("aus.sort");
|
cnd.asc("aus.sort");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -191,10 +191,13 @@ public class MWelfareController {
|
|||||||
*/
|
*/
|
||||||
@At
|
@At
|
||||||
public Result validateUserIntegral(String projectId, String totalIntegral) {
|
public Result validateUserIntegral(String projectId, String totalIntegral) {
|
||||||
BigDecimal totalIntegralBig = new BigDecimal(totalIntegral);
|
|
||||||
if (StrUtil.isBlank(projectId)) {
|
if (StrUtil.isBlank(projectId)) {
|
||||||
return Result.error("数据错误!");
|
return Result.error("数据错误!");
|
||||||
}
|
}
|
||||||
|
if (StrUtil.isBlank(totalIntegral)) {
|
||||||
|
return Result.error("请选择后在提交!");
|
||||||
|
}
|
||||||
|
BigDecimal totalIntegralBig = new BigDecimal(totalIntegral);
|
||||||
WelfareList welfareList = dao.fetch(WelfareList.class, Cnd.where("projectId", "=", projectId).and("userId", "=", ShiroUtil.getPrincipalProperty("id")));
|
WelfareList welfareList = dao.fetch(WelfareList.class, Cnd.where("projectId", "=", projectId).and("userId", "=", ShiroUtil.getPrincipalProperty("id")));
|
||||||
if (welfareList == null) {
|
if (welfareList == null) {
|
||||||
return Result.error("您暂无此福利!");
|
return Result.error("您暂无此福利!");
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -631,6 +631,9 @@ public class WelfareCommonController {
|
|||||||
|
|
||||||
//需要去查询最新的物流信息
|
//需要去查询最新的物流信息
|
||||||
String receiveAddress = userSelection.getReceiveAddress();
|
String receiveAddress = userSelection.getReceiveAddress();
|
||||||
|
if (StrUtil.isBlank(receiveAddress) || receiveAddress.length() < 11) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
String mobile = receiveAddress.substring(receiveAddress.length() - 11);
|
String mobile = receiveAddress.substring(receiveAddress.length() - 11);
|
||||||
|
|
||||||
JSONObject jsonObject = expressSelectUtil.getExpressInfo(courierNumber.getCourierNumber(), mobile);
|
JSONObject jsonObject = expressSelectUtil.getExpressInfo(courierNumber.getCourierNumber(), mobile);
|
||||||
|
|||||||
@@ -195,6 +195,9 @@ public class WelfareMineController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
String receiveAddress = userSelection.getReceiveAddress();
|
String receiveAddress = userSelection.getReceiveAddress();
|
||||||
|
if (StrUtil.isBlank(receiveAddress) || receiveAddress.length() < 11) {
|
||||||
|
return Result.error("收货信息为空,无法查询物流信息");
|
||||||
|
}
|
||||||
String mobile = receiveAddress.substring(receiveAddress.length() - 11);
|
String mobile = receiveAddress.substring(receiveAddress.length() - 11);
|
||||||
|
|
||||||
JSONObject jsonObject = expressSelectUtil.getExpressInfo(courierNumber, mobile);
|
JSONObject jsonObject = expressSelectUtil.getExpressInfo(courierNumber, mobile);
|
||||||
|
|||||||
@@ -186,7 +186,10 @@ public class WelfareUserChooseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//如果是积分模式
|
//如果是积分模式
|
||||||
if (project.getIsIntegralMode()) {
|
if (Boolean.TRUE.equals(project.getIsIntegralMode())) {
|
||||||
|
if (StrUtil.isBlank(totalIntegral)) {
|
||||||
|
return Result.error("请选择后在提交!");
|
||||||
|
}
|
||||||
BigDecimal totalIntegralBig = new BigDecimal(totalIntegral);
|
BigDecimal totalIntegralBig = new BigDecimal(totalIntegral);
|
||||||
totalIntegralBig = totalIntegralBig.divide(BigDecimal.valueOf(100));
|
totalIntegralBig = totalIntegralBig.divide(BigDecimal.valueOf(100));
|
||||||
if (totalIntegralBig.compareTo(BigDecimal.ZERO) == 0) {
|
if (totalIntegralBig.compareTo(BigDecimal.ZERO) == 0) {
|
||||||
@@ -209,7 +212,10 @@ public class WelfareUserChooseController {
|
|||||||
for (WelfareUserSelection welfareUserSelection : welfareUserSelections) {
|
for (WelfareUserSelection welfareUserSelection : welfareUserSelections) {
|
||||||
welfareUserSelection.setSelectUserId(userId);
|
welfareUserSelection.setSelectUserId(userId);
|
||||||
welfareUserSelection.setSelectTime(new Date());
|
welfareUserSelection.setSelectTime(new Date());
|
||||||
if (welfareUserSelection.getSelectNum() > 1 && !project.getIsIntegralMode()) {
|
if (StrUtil.isBlank(welfareUserSelection.getReceiveAddress())) {
|
||||||
|
welfareUserSelection.setReceiveAddress("");
|
||||||
|
}
|
||||||
|
if (welfareUserSelection.getSelectNum() > 1 && !Boolean.TRUE.equals(project.getIsIntegralMode())) {
|
||||||
return Result.error("福利选择限制超过最大限制");
|
return Result.error("福利选择限制超过最大限制");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,7 +109,7 @@
|
|||||||
header-align="center"
|
header-align="center"
|
||||||
v-if="is_integral_mode" label="所需积分" width="150">
|
v-if="is_integral_mode" label="所需积分" width="150">
|
||||||
<template slot-scope="{row}">
|
<template slot-scope="{row}">
|
||||||
<el-input-number v-model="row.integral" style="width: 100%"></el-input-number>
|
<el-input-number v-model="row.integral" style="width: 100%" :min="1"></el-input-number>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
@@ -188,7 +188,7 @@
|
|||||||
optionName:'福利'+(s.options.length+1),
|
optionName:'福利'+(s.options.length+1),
|
||||||
optionSort:s.options.length+1,
|
optionSort:s.options.length+1,
|
||||||
imgUrl:null,
|
imgUrl:null,
|
||||||
integral:0,
|
integral:1,
|
||||||
isDefaultOption:false,
|
isDefaultOption:false,
|
||||||
isSystemDefault:false})">
|
isSystemDefault:false})">
|
||||||
添加福利
|
添加福利
|
||||||
@@ -281,8 +281,8 @@ module.exports = {
|
|||||||
subjectName: '题目' + (this.subject.length + 1),
|
subjectName: '题目' + (this.subject.length + 1),
|
||||||
subjectType: type,
|
subjectType: type,
|
||||||
options: [
|
options: [
|
||||||
{optionName: '选项一', imgUrl: null},
|
{optionName: '选项一', imgUrl: null, integral: 1},
|
||||||
{optionName: '选项一', imgUrl: null}
|
{optionName: '选项一', imgUrl: null, integral: 1}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
this.subject.push(subject)
|
this.subject.push(subject)
|
||||||
|
|||||||
@@ -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>
|
||||||
@@ -348,9 +351,12 @@ layout("/mobile/platform.html"){
|
|||||||
<van-field label="联系方式" v-model="mobile" required placeholder="请输入联系方式" type="tel"
|
<van-field label="联系方式" v-model="mobile" required placeholder="请输入联系方式" type="tel"
|
||||||
maxlength="11"></van-field>
|
maxlength="11"></van-field>
|
||||||
</van-cell>
|
</van-cell>
|
||||||
|
<!-- 取货门店改为非必填,手机端暂不展示门店选择入口 -->
|
||||||
|
<!--
|
||||||
<van-cell @click="openShoppingPopup(item,index)" is-link title="取货门店" v-if="item.shoppingId">
|
<van-cell @click="openShoppingPopup(item,index)" is-link title="取货门店" v-if="item.shoppingId">
|
||||||
<template #label>{{item.receiveAddress?item.receiveAddress:'暂未选择'}}</template>
|
<template #label>{{item.receiveAddress?item.receiveAddress:'暂未选择'}}</template>
|
||||||
</van-cell>
|
</van-cell>
|
||||||
|
-->
|
||||||
</van-cell>
|
</van-cell>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -451,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
|
||||||
@@ -570,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
|
||||||
})
|
})
|
||||||
@@ -645,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) {
|
||||||
this.selectAddress = this.userSelection[0].receiveAddress
|
if (this.isSelect && this.userSelection) {
|
||||||
|
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())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//回显用户签名
|
//回显用户签名
|
||||||
@@ -663,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 === "") {
|
||||||
@@ -676,13 +700,9 @@ layout("/mobile/platform.html"){
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const notReceiveAddress = []
|
|
||||||
const formData = this.projectInfo.welfareProjectSubjects[0].options
|
const formData = this.projectInfo.welfareProjectSubjects[0].options
|
||||||
.filter((v) => v.selectNum >= 1)
|
.filter((v) => v.selectNum >= 1)
|
||||||
.map((v) => {
|
.map((v) => {
|
||||||
if (v.shoppingId && !v.receiveAddress) {
|
|
||||||
notReceiveAddress.push(v.optionName)
|
|
||||||
}
|
|
||||||
return {
|
return {
|
||||||
welfareId: this.projectId,
|
welfareId: this.projectId,
|
||||||
subjectId: v.subjectId,
|
subjectId: v.subjectId,
|
||||||
@@ -692,14 +712,11 @@ layout("/mobile/platform.html"){
|
|||||||
selectNum: v.selectNum
|
selectNum: v.selectNum
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if (notReceiveAddress.length > 0) {
|
|
||||||
this.$modal.msg("请选择取货门店:" + notReceiveAddress.join(","))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const {code, msg, data} = await $.post("/platform/welfare/userChoose/confirmSelect", {
|
const {code, msg, data} = await $.post("/platform/welfare/userChoose/confirmSelect", {
|
||||||
welfareUserSelections: JSON.stringify(formData),
|
welfareUserSelections: JSON.stringify(formData),
|
||||||
projectId: this.projectId,
|
projectId: this.projectId,
|
||||||
mobile: this.mobile
|
mobile: this.mobile,
|
||||||
|
totalIntegral: this.totalIntegral
|
||||||
})
|
})
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
this.getUserSelection(this.projectId)
|
this.getUserSelection(this.projectId)
|
||||||
@@ -747,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("收货地址限哈尔滨市:" + 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() {
|
||||||
|
|||||||
@@ -34,13 +34,52 @@ layout("/mobile/platform.html"){
|
|||||||
<script>
|
<script>
|
||||||
<!--#include("/mobile/welfare/include/areaList.js"){};include("/mobile/welfare/include/mixins.js"){}#-->
|
<!--#include("/mobile/welfare/include/areaList.js"){};include("/mobile/welfare/include/mixins.js"){}#-->
|
||||||
|
|
||||||
|
const welfareReceiveAreaList = {
|
||||||
|
province_list: {
|
||||||
|
230000: "黑龙江省"
|
||||||
|
},
|
||||||
|
city_list: {
|
||||||
|
230100: "哈尔滨市"
|
||||||
|
},
|
||||||
|
county_list: {
|
||||||
|
230102: "道里区",
|
||||||
|
230103: "南岗区",
|
||||||
|
230104: "道外区",
|
||||||
|
230108: "平房区",
|
||||||
|
230109: "松北区",
|
||||||
|
230110: "香坊区",
|
||||||
|
230111: "呼兰区",
|
||||||
|
230112: "阿城区",
|
||||||
|
230113: "双城区"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getAreaCodeByName(source, name) {
|
||||||
|
const entry = Object.entries(source).find(([, label]) => label === name)
|
||||||
|
return entry ? entry[0] : null
|
||||||
|
}
|
||||||
|
|
||||||
|
function ensureAddressAreaList(sourceAreaList, addressInfo) {
|
||||||
|
const provinceCode = getAreaCodeByName(areaList.province_list, addressInfo.province)
|
||||||
|
const cityCode = getAreaCodeByName(areaList.city_list, addressInfo.city)
|
||||||
|
const countyCode = getAreaCodeByName(areaList.county_list, addressInfo.county)
|
||||||
|
if (!provinceCode || !cityCode || !countyCode) {
|
||||||
|
return sourceAreaList
|
||||||
|
}
|
||||||
|
const nextAreaList = JSON.parse(JSON.stringify(sourceAreaList))
|
||||||
|
nextAreaList.province_list[provinceCode] = addressInfo.province
|
||||||
|
nextAreaList.city_list[cityCode] = addressInfo.city
|
||||||
|
nextAreaList.county_list[countyCode] = addressInfo.county
|
||||||
|
return nextAreaList
|
||||||
|
}
|
||||||
|
|
||||||
const vue = new Vue({
|
const vue = new Vue({
|
||||||
el: "#app",
|
el: "#app",
|
||||||
mixins: [mobileMixins, welfareMixins],
|
mixins: [mobileMixins, welfareMixins],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
projectId: GetQueryString("projectId"),
|
projectId: GetQueryString("projectId"),
|
||||||
areaList: areaList,
|
areaList: welfareReceiveAreaList,
|
||||||
addressInfo: {},
|
addressInfo: {},
|
||||||
addressId: null
|
addressId: null
|
||||||
}
|
}
|
||||||
@@ -95,6 +134,7 @@ layout("/mobile/platform.html"){
|
|||||||
const resp = await $.get("/mobile/welfare/mine/findOneUserAddress", { id: this.addressId })
|
const resp = await $.get("/mobile/welfare/mine/findOneUserAddress", { id: this.addressId })
|
||||||
if (resp.code === 0) {
|
if (resp.code === 0) {
|
||||||
this.addressInfo = resp.data
|
this.addressInfo = resp.data
|
||||||
|
this.areaList = ensureAddressAreaList(welfareReceiveAreaList, this.addressInfo)
|
||||||
}
|
}
|
||||||
this.closeLoading()
|
this.closeLoading()
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -327,8 +327,8 @@ layout("/layouts/platform.html"){
|
|||||||
// { prop: "unionGroupName", label: "工会小组", sortable: true, checked: 0 },
|
// { prop: "unionGroupName", label: "工会小组", sortable: true, checked: 0 },
|
||||||
{ prop: "optionName", label: "所选套餐", width: "100px" },
|
{ prop: "optionName", label: "所选套餐", width: "100px" },
|
||||||
{ prop: "selectTime", label: "选择时间", width: "160px" },
|
{ prop: "selectTime", label: "选择时间", width: "160px" },
|
||||||
{ prop: "isAudit", label: "是否确认" },
|
/*{ prop: "isAudit", label: "是否确认" },
|
||||||
{ prop: "auditTime", label: "确认时间" }
|
{ prop: "auditTime", label: "确认时间" }*/
|
||||||
// {prop: 'userSign', label: '签字', width: "100px"},
|
// {prop: 'userSign', label: '签字', width: "100px"},
|
||||||
],
|
],
|
||||||
exportHealthCheckupDialog: false,
|
exportHealthCheckupDialog: false,
|
||||||
|
|||||||
@@ -405,7 +405,7 @@ layout("/layouts/platform.html"){
|
|||||||
this.tableColumns.push(
|
this.tableColumns.push(
|
||||||
{ prop: "totalCount", label: "选取人数" },
|
{ prop: "totalCount", label: "选取人数" },
|
||||||
{ prop: "unselectedTeacherSum", label: "未选人数" },
|
{ prop: "unselectedTeacherSum", label: "未选人数" },
|
||||||
{ prop: "isAudit", label: "是否核对" }
|
// { prop: "isAudit", label: "是否核对" }
|
||||||
)
|
)
|
||||||
this.$refs.table_tool.getColumns()
|
this.$refs.table_tool.getColumns()
|
||||||
if (!this.pageForm.projectId) {
|
if (!this.pageForm.projectId) {
|
||||||
|
|||||||
@@ -115,12 +115,62 @@ layout("/layouts/platform.html"){
|
|||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
|
const welfareReceiveAreaList = ["道里区", "南岗区", "道外区", "香坊区", "呼兰区", "松北区", "阿城区", "双城区", "平房区"]
|
||||||
|
|
||||||
|
function getWelfareReceiveDzOptions() {
|
||||||
|
const province = chengShiList.find((c) => c.label === "黑龙江省")
|
||||||
|
if (!province) {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
const city = province.children.find((c) => c.label === "哈尔滨市")
|
||||||
|
if (!city) {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
...province,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
...city,
|
||||||
|
children: city.children.filter((county) => welfareReceiveAreaList.includes(county.label))
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
function ensureAddressDzOption(options, row) {
|
||||||
|
const provinceTemplate = chengShiList.find((c) => c.label === row.province)
|
||||||
|
const cityTemplate = provinceTemplate?.children?.find((c) => c.label === row.city)
|
||||||
|
if (!provinceTemplate || !cityTemplate) {
|
||||||
|
return options
|
||||||
|
}
|
||||||
|
const nextOptions = JSON.parse(JSON.stringify(options))
|
||||||
|
let province = nextOptions.find((c) => c.label === row.province)
|
||||||
|
if (!province) {
|
||||||
|
province = {...provinceTemplate, children: []}
|
||||||
|
nextOptions.push(province)
|
||||||
|
}
|
||||||
|
let city = province.children.find((c) => c.label === row.city)
|
||||||
|
if (!city) {
|
||||||
|
city = {...cityTemplate, children: []}
|
||||||
|
province.children.push(city)
|
||||||
|
}
|
||||||
|
if (row.county) {
|
||||||
|
const countyTemplate = cityTemplate.children?.find((c) => c.label === row.county)
|
||||||
|
if (countyTemplate && !city.children.find((c) => c.label === row.county)) {
|
||||||
|
city.children.push(countyTemplate)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nextOptions
|
||||||
|
}
|
||||||
|
|
||||||
const vue = new Vue({
|
const vue = new Vue({
|
||||||
el: "#app",
|
el: "#app",
|
||||||
mixins: [initTableMixins],
|
mixins: [initTableMixins],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
dzOptions: chengShiList,
|
dzOptions: getWelfareReceiveDzOptions(),
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
tableColumns: [
|
tableColumns: [
|
||||||
{ prop: "userName", label: "收货人" },
|
{ prop: "userName", label: "收货人" },
|
||||||
@@ -180,6 +230,7 @@ layout("/layouts/platform.html"){
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
openAddress() {
|
openAddress() {
|
||||||
|
this.dzOptions = getWelfareReceiveDzOptions()
|
||||||
this.formData = {
|
this.formData = {
|
||||||
userName: "${@shiro.getPrincipalProperty('username')}",
|
userName: "${@shiro.getPrincipalProperty('username')}",
|
||||||
tel: "${@shiro.getPrincipalProperty('mobile')}"
|
tel: "${@shiro.getPrincipalProperty('mobile')}"
|
||||||
@@ -223,16 +274,15 @@ layout("/layouts/platform.html"){
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
openEdit(row) {
|
openEdit(row) {
|
||||||
|
this.dzOptions = ensureAddressDzOption(getWelfareReceiveDzOptions(), row)
|
||||||
row.addressList = []
|
row.addressList = []
|
||||||
const province = chengShiList.find((c) => c.label === row.province)
|
const province = this.dzOptions.find((c) => c.label === row.province)
|
||||||
row.addressList.push(province.value)
|
row.addressList.push(province.value)
|
||||||
const city = province.children.find((p) => p.label === row.city)
|
const city = province.children.find((p) => p.label === row.city)
|
||||||
row.addressList.push(city.value)
|
row.addressList.push(city.value)
|
||||||
if (row.county) {
|
if (row.county) {
|
||||||
const county = city.children.find((p) => p.label === row.county)
|
const county = city.children.find((p) => p.label === row.county)
|
||||||
if (county) {
|
row.addressList.push(county.value)
|
||||||
row.addressList.push(county.value)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.formData = { ...row }
|
this.formData = { ...row }
|
||||||
|
|||||||
@@ -310,7 +310,7 @@ layout("/layouts/platform.html"){
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col span="8" v-if="formData.isIntegralMode">
|
<el-col span="8" v-if="formData.isIntegralMode">
|
||||||
<el-form-item label="总积分" prop="allIntegral">
|
<el-form-item label="总积分" prop="allIntegral">
|
||||||
<el-input-number v-model="formData.allIntegral" style="width: 100%" min="0"></el-input-number>
|
<el-input-number v-model="formData.allIntegral" style="width: 100%" :min="0"></el-input-number>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@@ -643,6 +643,10 @@ layout("/layouts/platform.html"){
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (this.formData.isIntegralMode && (!this.formData.allIntegral || this.formData.allIntegral <= 0)) {
|
||||||
|
this.$message.warning("积分模式下总积分不能为0,请填写总积分!")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
this.submitLoading = true
|
this.submitLoading = true
|
||||||
const loading = this.$loading({
|
const loading = this.$loading({
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ layout("/layouts/platform.html"){
|
|||||||
:max="option.maxNum"
|
:max="option.maxNum"
|
||||||
:min="0"
|
:min="0"
|
||||||
@keydown.native="onKeydown"
|
@keydown.native="onKeydown"
|
||||||
@change="numChange(option.selectNum, option, oidx)"
|
@change="(value, oldValue)=>{numChange(value, oldValue, option, oidx)}"
|
||||||
style="width: 150px; position: absolute; right: 0; bottom: 0"
|
style="width: 150px; position: absolute; right: 0; bottom: 0"
|
||||||
v-model="option.selectNum"
|
v-model="option.selectNum"
|
||||||
></el-input-number>
|
></el-input-number>
|
||||||
@@ -257,6 +257,8 @@ layout("/layouts/platform.html"){
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<!-- 取货门店改为非必填,PC端暂不展示门店选择入口 -->
|
||||||
|
<!--
|
||||||
<div style="margin-top: 17px">
|
<div style="margin-top: 17px">
|
||||||
<el-select
|
<el-select
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
@@ -274,6 +276,7 @@ layout("/layouts/platform.html"){
|
|||||||
></el-option>
|
></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
|
-->
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
@@ -323,7 +326,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>
|
||||||
@@ -447,6 +450,30 @@ layout("/layouts/platform.html"){
|
|||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
|
const welfareReceiveAreaList = ["道里区", "南岗区", "道外区", "香坊区", "呼兰区", "松北区", "阿城区", "双城区", "平房区"]
|
||||||
|
|
||||||
|
function getWelfareReceiveDzOptions() {
|
||||||
|
const province = chengShiList.find((c) => c.label === "黑龙江省")
|
||||||
|
if (!province) {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
const city = province.children.find((c) => c.label === "哈尔滨市")
|
||||||
|
if (!city) {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
...province,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
...city,
|
||||||
|
children: city.children.filter((county) => welfareReceiveAreaList.includes(county.label))
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
const vue = new Vue({
|
const vue = new Vue({
|
||||||
el: "#app",
|
el: "#app",
|
||||||
mixins: [initTableMixins],
|
mixins: [initTableMixins],
|
||||||
@@ -457,10 +484,13 @@ layout("/layouts/platform.html"){
|
|||||||
welfareSignMode: [],
|
welfareSignMode: [],
|
||||||
userSelection: [],
|
userSelection: [],
|
||||||
userSign: "",
|
userSign: "",
|
||||||
dzOptions: chengShiList,
|
dzOptions: getWelfareReceiveDzOptions(),
|
||||||
addressList: [],
|
addressList: [],
|
||||||
descData: "",
|
descData: "",
|
||||||
descDialogVisible: false,
|
descDialogVisible: false,
|
||||||
|
selectedAddressCity: null,
|
||||||
|
selectedAddressCounty: null,
|
||||||
|
receiveAddressAreaList: welfareReceiveAreaList,
|
||||||
|
|
||||||
projectInfo: {},
|
projectInfo: {},
|
||||||
welfareSubject: {},
|
welfareSubject: {},
|
||||||
@@ -505,6 +535,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
|
||||||
@@ -595,15 +628,7 @@ layout("/layouts/platform.html"){
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
//数量更改
|
//数量更改
|
||||||
numChange(value, option, optionIndex) {
|
numChange(value, oldValue, 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,13 +637,17 @@ 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") {
|
||||||
|
if (value > 0) {
|
||||||
|
this.projectInfo.welfareProjectSubjects[0].options.forEach((v, index) => {
|
||||||
|
if (index !== optionIndex) {
|
||||||
|
this.$set(v, "selectNum", 0)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
//判断是否支持单个多选
|
//判断是否支持单个多选
|
||||||
if (!singleOptionSupportMultipleSelection && value > 1) {
|
if (!singleOptionSupportMultipleSelection && value > 1) {
|
||||||
this.$set(this.projectInfo.welfareProjectSubjects[0].options[optionIndex], "selectNum", 1)
|
this.$set(this.projectInfo.welfareProjectSubjects[0].options[optionIndex], "selectNum", 1)
|
||||||
@@ -631,11 +660,18 @@ layout("/layouts/platform.html"){
|
|||||||
const sum = selectNums.reduce((accumulator, currentValue) => accumulator + currentValue, 0)
|
const sum = selectNums.reduce((accumulator, currentValue) => accumulator + currentValue, 0)
|
||||||
|
|
||||||
if (sum > multiSelectNum) {
|
if (sum > multiSelectNum) {
|
||||||
this.$set(this.projectInfo.welfareProjectSubjects[0].options[optionIndex], "selectNum", value - 1)
|
this.$set(this.projectInfo.welfareProjectSubjects[0].options[optionIndex], "selectNum", oldValue == null ? 0 : oldValue)
|
||||||
this.$message.warning("此次福利最多只能选择" + multiSelectNum + "份")
|
this.$message.warning("此次福利最多只能选择" + multiSelectNum + "份")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
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 +700,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() {
|
||||||
@@ -671,9 +712,8 @@ layout("/layouts/platform.html"){
|
|||||||
if (valid) {
|
if (valid) {
|
||||||
const {isCheckBox, multiSelectNum, singleOptionSupportMultipleSelection} = this.projectInfo
|
const {isCheckBox, multiSelectNum, singleOptionSupportMultipleSelection} = this.projectInfo
|
||||||
if (isCheckBox === "checkBox") {
|
if (isCheckBox === "checkBox") {
|
||||||
if (this.sumSelectNum < multiSelectNum) {
|
if (this.sumSelectNum === 0) {
|
||||||
//用户没有选择完
|
this.$message.warning("您还没有选择福利套餐,快去选择吧!")
|
||||||
this.$message.warning("一共可以选择" + multiSelectNum + "份,您目前只选择了" + this.sumSelectNum + "份,快去选择吧!")
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -684,35 +724,14 @@ layout("/layouts/platform.html"){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 判断门店是否选择
|
|
||||||
console.log(this.projectInfo.welfareProjectSubjects[0])
|
|
||||||
const chooseOptions = this.projectInfo.welfareProjectSubjects[0].options
|
|
||||||
.filter((v) => v.selectNum > 0 && v.shoppingId)
|
|
||||||
.map((item) => {
|
|
||||||
return {
|
|
||||||
optionName: item.optionName,
|
|
||||||
receiveAddressList: item.receiveAddressList,
|
|
||||||
selectNum: item.selectNum,
|
|
||||||
receiveAddress: item.receiveAddress
|
|
||||||
}
|
|
||||||
})
|
|
||||||
let isReceiveAddress = true
|
|
||||||
for (const item of chooseOptions) {
|
|
||||||
if (!item.receiveAddress && item.receiveAddressList.length > 0) {
|
|
||||||
this.$message.warning(item.optionName + "还没有选择收货门店哦")
|
|
||||||
isReceiveAddress = false
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!isReceiveAddress) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.projectInfo.provideMode == 3) {
|
if (this.projectInfo.provideMode == 3) {
|
||||||
if (this.formData.receiveAddress == null || this.formData.receiveAddress === "") {
|
if (this.formData.receiveAddress == null || this.formData.receiveAddress === "") {
|
||||||
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)) {
|
||||||
@@ -731,6 +750,7 @@ layout("/layouts/platform.html"){
|
|||||||
receiveAddress: this.projectInfo.provideMode === 3 ? this.formData.receiveAddress : v.receiveAddress,
|
receiveAddress: this.projectInfo.provideMode === 3 ? this.formData.receiveAddress : v.receiveAddress,
|
||||||
userSign: this.formData.sign,
|
userSign: this.formData.sign,
|
||||||
selectNum: v.selectNum
|
selectNum: v.selectNum
|
||||||
|
// selectNum: Number(v.selectNum)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const {code, msg, data} = await $.post("/platform/welfare/userChoose/confirmSelect", {
|
const {code, msg, data} = await $.post("/platform/welfare/userChoose/confirmSelect", {
|
||||||
@@ -766,22 +786,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 +845,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("收货地址限哈尔滨市:" + 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