更新10.16

This commit is contained in:
许允枞 2024-10-16 13:28:52 +08:00
parent 7287f92406
commit c7f624f62a
4 changed files with 317 additions and 248 deletions

View File

@ -92,6 +92,16 @@ public class FleetMemberController extends BaseController {
public ResponseObject add(@RequestBody FleetMember fleetMember) {
return getSuccessResult(fleetMemberService.insert(fleetMember));
}
/**
* 新增数据小程序
*
* @param fleetMember 实体
* @return 新增结果
*/
@PostMapping("addUni")
public ResponseObject addUni(@RequestBody FleetMember fleetMember) {
return getSuccessResult(fleetMemberService.insertUni(fleetMember));
}
/**
* 编辑数据

View File

@ -49,6 +49,13 @@ public interface FleetMemberService {
* @return 实例对象
*/
int insert(FleetMember fleetMember);
/**
* 新增数据
*
* @param fleetMember 实例对象
* @return 实例对象
*/
int insertUni(FleetMember fleetMember);
/**
* 新增数据

View File

@ -167,6 +167,49 @@ public class FleetMemberServiceImpl extends ServiceImpl<FleetMemberMapper, Fleet
return baseMapper.insert(fleetMember);
}
/**
* 新增数据
*
* @param fleetMember 实例对象
* @return 实例对象
*/
@Override
public int insertUni(FleetMember fleetMember) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
//判断用户是否加入车队
FleetMember fleetMember2 = baseMapper.selectOne(new LambdaQueryWrapper<FleetMember>()
.eq(FleetMember::getMobile, fleetMember.getMobile())
.last("limit 1"));
if (ObjectUtil.isNotEmpty(fleetMember2)) {
// throw new RuntimeException("该用户已绑定车队");
return 0;
}
//判断当前车队成员否存在账号
MtUser mtUser = mtUserMapper.selectOne(new LambdaQueryWrapper<MtUser>()
.eq(MtUser::getMobile, fleetMember.getMobile())
.last("limit 1"));
if (ObjectUtil.isEmpty(mtUser)) {
//注册用户
mtUser = new MtUser();
mtUser.setUserNo(editUserNo());
mtUser.setMobile(fleetMember.getMobile());
mtUser.setName(fleetMember.getName());
mtUser.setDescription("车队成员自动注册");
mtUser.setCreateTime(DateUtil.date());
mtUserMapper.insert(mtUser);
createVaseInfo(mtUser, nowAccountInfo.getStoreId().toString(), null, null);
}
fleetMember.setUserId(mtUser.getId());
fleetMember.setCarNum(mtUser.getCarNo());
fleetMember.setStoreId(nowAccountInfo.getStoreId());
fleetMember.setChainStoreId(nowAccountInfo.getChainStoreId());
return baseMapper.insert(fleetMember);
}
@Override
public int insertFleetMember(FleetMemberVo fleetMember) {
FleetMember fleetMember1 = queryByMobile(fleetMember);

View File

@ -1,272 +1,281 @@
<template>
<view class="content">
<view class="container">
<view class="box-hang">
<view class=""><span style="color: red;">*</span>姓名</view>
<view class="dis">
<input v-model="memberInfo.name" style="text-align: right;" placeholder="请输入"></input>
</view>
</view>
<view class="box-hang">
<view class=""><span style="color: red;">*</span>手机号</view>
<view class="dis">
<input v-model="memberInfo.mobile" style="text-align: right;" placeholder="请输入"></input>
</view>
</view>
<view class="box-hang">
<view class="">会员卡号</view>
<view class="dis">
<input v-model="memberInfo.userCardNum" style="text-align: right;" placeholder="请输入"></input>
</view>
</view>
<view class="box-hang">
<view class="">车牌号</view>
<view class="dis" @click="show1 = !show1">
<input v-model="memberInfo.carNum" style="text-align: right;" placeholder="请输入"></input>
</view>
</view>
<view class="box-hang">
<view class=""><span style="color: red;">*</span>副卡类型</view>
<view class="dis" @click="show = !show">
<text v-if="memberInfo.secondaryCardType==1">共享副卡-不限额</text>
<text v-if="memberInfo.secondaryCardType==2">共享副卡-限额</text>
<text v-if="memberInfo.secondaryCardType==3">独立副卡</text>
<uni-icons type="right" size="16"></uni-icons>
</view>
</view>
<view class="box-hang" style="margin-top: 10px;">
<view class=""><span style="color: red;">*</span>是否开启消费通知</view>
<view class="dis">
<u-switch v-model="memberInfo.isOpenNotice" :activeValue='0' :inactiveValue='1' activeColor="#6DD400"
inactiveColor="rgb(230, 230, 230)"></u-switch>
</view>
</view>
<view class="box-hang">
<view class=""><span style="color: red;">*</span>是否启用</view>
<view class="dis">
<u-switch v-model="memberInfo.status" activeValue='qy' inactiveValue='jy' activeColor="#6DD400"
inactiveColor="rgb(230, 230, 230)"></u-switch>
</view>
</view>
<view class="box-end">
<view style="display: flex;">
<view style="height: 14px;margin-right: 5px;"><u-icon name="info-circle"></u-icon></view>
<view></view>
</view>
<view>
<view>共享副卡-不限额副卡与主卡共享钱包同步余额</view>
<view>共享副卡-限额副卡与主卡共享钱包副卡可设置限额</view>
<view>独立副卡副卡与主卡独立钱包独立余额</view>
</view>
</view>
<view class="content">
<view class="container">
<view class="box-hang">
<view class=""><span style="color: red;">*</span>姓名</view>
<view class="dis">
<input v-model="memberInfo.name" style="text-align: right;" placeholder="请输入"></input>
</view>
</view>
<view class="box-hang">
<view class=""><span style="color: red;">*</span>手机号</view>
<view class="dis">
<input v-model="memberInfo.mobile" style="text-align: right;" placeholder="请输入"></input>
</view>
</view>
<view class="box-hang">
<view class="">会员卡号</view>
<view class="dis">
<input v-model="memberInfo.userCardNum" style="text-align: right;" placeholder="请输入"></input>
</view>
</view>
<view class="box-hang">
<view class="">车牌号</view>
<view class="dis" @click="show1 = !show1">
<input v-model="memberInfo.carNum" style="text-align: right;" placeholder="请输入"></input>
</view>
</view>
<view class="box-hang">
<view class=""><span style="color: red;">*</span>副卡类型</view>
<view class="dis" @click="show = !show">
<text v-if="memberInfo.secondaryCardType==1">共享副卡-不限额</text>
<text v-if="memberInfo.secondaryCardType==2">共享副卡-限额</text>
<text v-if="memberInfo.secondaryCardType==3">独立副卡</text>
<uni-icons type="right" size="16"></uni-icons>
</view>
</view>
<view class="box-hang" style="margin-top: 10px;">
<view class=""><span style="color: red;">*</span>是否开启消费通知</view>
<view class="dis">
<u-switch v-model="memberInfo.isOpenNotice" :activeValue='0' :inactiveValue='1' activeColor="#6DD400"
inactiveColor="rgb(230, 230, 230)"></u-switch>
</view>
</view>
<view class="box-hang">
<view class=""><span style="color: red;">*</span>是否启用</view>
<view class="dis">
<u-switch v-model="memberInfo.status" activeValue='qy' inactiveValue='jy' activeColor="#6DD400"
inactiveColor="rgb(230, 230, 230)"></u-switch>
</view>
</view>
<view class="box-end">
<view style="display: flex;">
<view style="height: 14px;margin-right: 5px;">
<u-icon name="info-circle"></u-icon>
</view>
<view></view>
</view>
<view>
<view>共享副卡-不限额副卡与主卡共享钱包同步余额</view>
<view>共享副卡-限额副卡与主卡共享钱包副卡可设置限额</view>
<view>独立副卡副卡与主卡独立钱包独立余额</view>
</view>
</view>
<view class="but-sub" @click="submitFrom()">保存</view>
<view class="but-sub" @click="submitFrom()">保存</view>
<u-picker :show="show" :columns="columns" @cancel="cancel" @confirm="confirm"></u-picker>
<u-keyboard ref="uKeyboard" mode="car" @change="valChange" @backspace="backspace" :show="show1"
@confirm="confirm1" @cancel="cancel1" :overlay="false"></u-keyboard>
</view>
<u-picker :show="show" :columns="columns" @cancel="cancel" @confirm="confirm"></u-picker>
<u-keyboard ref="uKeyboard" mode="car" @change="valChange" @backspace="backspace" :show="show1"
@confirm="confirm1" @cancel="cancel1" :overlay="false"></u-keyboard>
</view>
</view>
</view>
</template>
<script>
import request from '../../utils/request';
export default {
data() {
return {
title: '',
List: [],
pageNo: 1,
pageSize: 10,
totalPage: '',
value: "",
value1: true,
value2: true,
show: false,
show1: false,
columns: [
['共享副卡-不限额', '共享副卡-限额', '独立副卡']
],
memberInfo: {
carNum: '',
isOpenNotice: '0',
status: 'qy',
secondaryCardType: 1
},
fleetId: '',
memberId: '',
}
},
onLoad(e) {
if (e.fleetId) {
this.fleetId = e.fleetId
this.memberInfo.fleetId = e.fleetId
}
if (e.memberId){
this.memberId = e.memberId
this.getInfo()
}
},
onPullDownRefresh() {
//
import request from '../../utils/request';
},
onReachBottom() {
//
if (this.pageNo >= this.totalPage) {
export default {
data() {
return {
title: '',
List: [],
pageNo: 1,
pageSize: 10,
totalPage: '',
value: "",
value1: true,
value2: true,
show: false,
show1: false,
columns: [
['共享副卡-不限额', '共享副卡-限额', '独立副卡']
],
memberInfo: {
carNum: '',
isOpenNotice: '0',
status: 'qy',
secondaryCardType: 1
},
fleetId: '',
memberId: '',
}
},
onLoad(e) {
if (e.fleetId) {
this.fleetId = e.fleetId
this.memberInfo.fleetId = e.fleetId
}
if (e.memberId) {
this.memberId = e.memberId
this.getInfo()
}
},
onPullDownRefresh() {
//
} else {
this.pageNo++
},
onReachBottom() {
//
if (this.pageNo >= this.totalPage) {
}
},
} else {
this.pageNo++
components: {
}
},
},
methods: {
getInfo() {
request({
url: '/fleetMember/' + this.memberId,
method: 'get',
}).then(res => {
this.memberInfo = res.data
})
},
submitFrom() {
if (!this.memberInfo.name) {
uni.showToast({
title: '姓名不能为空',
icon: 'none'
})
return
}
if (!this.memberInfo.mobile) {
uni.showToast({
title: '手机号不能为空',
icon: 'none'
})
return
}
if (this.memberInfo.id){
request({
url: '/fleetMember',
method: 'put',
data: this.memberInfo
}).then(res => {
uni.navigateBack()
})
}else{
request({
url: '/fleetMember',
method: 'post',
data: this.memberInfo
}).then(res => {
uni.navigateBack()
})
}
},
// (退)
valChange(val) {
// value+=
this.memberInfo.carNum += val
},
// 退
backspace() {
// value
if (this.memberInfo.carNum.length) this.memberInfo.carNum = this.memberInfo.carNum.substr(0, this
.memberInfo.carNum.length - 1);
},
cancel1() {
this.show1 = false
},
confirm1() {
this.show1 = false
},
cancel() {
this.show = false
},
confirm(e) {
this.memberInfo.secondaryCardType = e.indexs[0] + 1
this.show = false
},
goback() {
uni.navigateBack()
}
}
}
components: {},
methods: {
getInfo() {
request({
url: '/fleetMember/' + this.memberId,
method: 'get',
}).then(res => {
this.memberInfo = res.data
})
},
submitFrom() {
if (!this.memberInfo.name) {
uni.showToast({
title: '姓名不能为空',
icon: 'none'
})
return
}
if (!this.memberInfo.mobile) {
uni.showToast({
title: '手机号不能为空',
icon: 'none'
})
return
}
if (this.memberInfo.id) {
request({
url: '/fleetMember',
method: 'put',
data: this.memberInfo
}).then(res => {
uni.navigateBack()
})
} else {
request({
url: '/fleetMember/addUni',
method: 'post',
data: this.memberInfo
}).then(res => {
if (res.data == 0) {
uni.showToast({
title: '该用户已绑定车队',
icon: 'none'
})
}else {
uni.navigateBack()
}
})
}
},
// (退)
valChange(val) {
// value+=
this.memberInfo.carNum += val
},
// 退
backspace() {
// value
if (this.memberInfo.carNum.length) this.memberInfo.carNum = this.memberInfo.carNum.substr(0, this
.memberInfo.carNum.length - 1);
},
cancel1() {
this.show1 = false
},
confirm1() {
this.show1 = false
},
cancel() {
this.show = false
},
confirm(e) {
this.memberInfo.secondaryCardType = e.indexs[0] + 1
this.show = false
},
goback() {
uni.navigateBack()
}
}
}
</script>
<style scoped lang="scss">
.content {
background: #f4f5f6;
}
.content {
background: #f4f5f6;
}
.container {
width: 100%;
height: 100vh;
box-sizing: border-box;
padding-top: 10px;
}
.container {
width: 100%;
height: 100vh;
box-sizing: border-box;
padding-top: 10px;
}
.my-header {
width: 100%;
height: 88px;
background: #ffffff;
display: flex;
align-items: center;
justify-content: space-between;
color: #000;
box-sizing: border-box;
padding: 0px 15px;
padding-top: 40px;
z-index: 99999;
.my-header {
width: 100%;
height: 88px;
background: #ffffff;
display: flex;
align-items: center;
justify-content: space-between;
color: #000;
box-sizing: border-box;
padding: 0px 15px;
padding-top: 40px;
z-index: 99999;
.my-icons {
width: 20px;
.my-icons {
width: 20px;
}
}
position: fixed;
top: 0px;
}
position: fixed;
top: 0px;
}
.box-hang {
background-color: white;
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 15px 15px;
border-bottom: 1px solid #f4f5f6;
}
.box-hang {
background-color: white;
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 15px 15px;
border-bottom: 1px solid #f4f5f6;
}
.dis {
color: #a69999;
}
.dis {
color: #a69999;
}
.box-end {
margin-top: 10px;
display: flex;
color: #999999;
font-size: 12px;
padding: 0 15px;
}
.box-end {
margin-top: 10px;
display: flex;
color: #999999;
font-size: 12px;
padding: 0 15px;
}
.but-sub {
width: 305px;
height: 40px;
line-height: 40px;
margin: 0 auto;
background-color: #FF9655;
color: white;
border-radius: 50px;
text-align: center;
position: absolute;
bottom: 40px;
left: 11%;
}
</style>
.but-sub {
width: 305px;
height: 40px;
line-height: 40px;
margin: 0 auto;
background-color: #FF9655;
color: white;
border-radius: 50px;
text-align: center;
position: absolute;
bottom: 40px;
left: 11%;
}
</style>