用户余额查询

This commit is contained in:
齐天大圣 2023-12-15 13:48:17 +08:00
parent 69eb9cccb5
commit 407af8365e
8 changed files with 144 additions and 20 deletions

View File

@ -366,6 +366,9 @@
<if test=" cardFuelRecord.mtUserId != null and cardFuelRecord.mtUserId != ''"> <if test=" cardFuelRecord.mtUserId != null and cardFuelRecord.mtUserId != ''">
and mt_user_id = #{cardFuelRecord.mtUserId} and mt_user_id = #{cardFuelRecord.mtUserId}
</if> </if>
<if test=" cardFuelRecord.storeId != null and cardFuelRecord.storeId != ''">
and store_id = #{cardFuelRecord.storeId}
</if>
</where> </where>
order by create_time order by create_time
</select> </select>

View File

@ -330,10 +330,12 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
*/ */
@Override @Override
public IPage<CardFuelRecord> queryByPageApplet(Page page, CardFuelRecord cardFuelRecord) { public IPage<CardFuelRecord> queryByPageApplet(Page page, CardFuelRecord cardFuelRecord) {
//获取登录用户id //获取登录用户信息
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Integer id = nowAccountInfo.getId(); Integer userId = nowAccountInfo.getId();
cardFuelRecord.setMtUserId(id); Integer storeId = nowAccountInfo.getStoreId();
cardFuelRecord.setMtUserId(userId);
cardFuelRecord.setStoreId(storeId);
return this.cardFuelRecordMapper.queryByPageApplet(page,cardFuelRecord); return this.cardFuelRecordMapper.queryByPageApplet(page,cardFuelRecord);
} }

View File

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.userManager.entity.LJUser; import com.fuint.business.userManager.entity.LJUser;
import com.fuint.business.userManager.entity.UserStatistic; import com.fuint.business.userManager.entity.UserStatistic;
import com.fuint.business.userManager.service.LJUserService; import com.fuint.business.userManager.service.LJUserService;
import com.fuint.business.userManager.service.UserBalanceService;
import com.fuint.business.userManager.service.UserStatisticService; import com.fuint.business.userManager.service.UserStatisticService;
import com.fuint.business.userManager.vo.LJUserVo; import com.fuint.business.userManager.vo.LJUserVo;
import com.fuint.framework.web.BaseController; import com.fuint.framework.web.BaseController;
@ -26,6 +27,8 @@ public class LJUserController extends BaseController {
private LJUserService userService; private LJUserService userService;
@Autowired @Autowired
private UserStatisticService statisticService; private UserStatisticService statisticService;
@Autowired
private UserBalanceService userBalanceService;
/** /**
* 根据条件分页查询会员信息 * 根据条件分页查询会员信息
@ -52,6 +55,15 @@ public class LJUserController extends BaseController {
return getSuccessResult(userService.selectUsersList()); return getSuccessResult(userService.selectUsersList());
} }
/**
* 查询会员储值卡余额
* @return
*/
@GetMapping("/getUserBalance")
public ResponseObject getUserBalance(){
return getSuccessResult(userBalanceService.getUserBalance());
}
/** /**
* 查询会员统计信息 * 查询会员统计信息
* @return * @return

View File

@ -42,4 +42,9 @@ public interface UserBalanceService extends IService<UserBalance> {
*/ */
public UserBalance selectUserBalance(int userId, int chainStoreId); public UserBalance selectUserBalance(int userId, int chainStoreId);
/**
* 查询会员储值卡余额
* @return
*/
UserBalance getUserBalance();
} }

View File

@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.userManager.entity.UserBalance; import com.fuint.business.userManager.entity.UserBalance;
import com.fuint.business.userManager.mapper.UserBalanceMapper; import com.fuint.business.userManager.mapper.UserBalanceMapper;
import com.fuint.business.userManager.service.UserBalanceService; import com.fuint.business.userManager.service.UserBalanceService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
@ -47,4 +49,18 @@ public class UserBalanceServiceImpl extends ServiceImpl<UserBalanceMapper, UserB
UserBalance balance = baseMapper.selectOne(queryWrapper); UserBalance balance = baseMapper.selectOne(queryWrapper);
return balance; return balance;
} }
/**
* 查询会员储值卡余额
* @return
*/
@Override
public UserBalance getUserBalance() {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("mt_user_id",nowAccountInfo.getId());
queryWrapper.eq("store_id",nowAccountInfo.getStoreId());
UserBalance balance = baseMapper.selectOne(queryWrapper);
return balance;
}
} }

View File

@ -9,17 +9,21 @@
<!-- 顶部区域 --> <!-- 顶部区域 -->
<!-- 储值卡 --> <!-- 储值卡 -->
<view class="xyihang">
<view class="title-hei">储值卡</view>
</view>
<view class="card-cz"> <view class="card-cz">
<view class="card-top"> <view class="card-top">
<view class="cardimg"> <view class="cardimg">
<image src="../../static/imgs/jyz.png" mode=""></image> <image src="../../static/imgs/jyz.png" mode=""></image>
</view> </view>
<text>油站名称</text> <!-- <text>油站名称</text> -->
</view> </view>
<view class="dis-but"> <view class="dis-but">
<view class="bai-box"> <view class="bai-box">
<view class="">通用余额</view> <view class="">通用余额</view>
<view class=""> <text style="font-weight: bold;font-size: 26px;">0.00</text> </view> <view class=""> <text style="font-weight: bold;font-size: 26px;">{{cardBalance}}</text>
</view>
</view> </view>
<view class="anniu-cz" @click="gocard()"> <view class="anniu-cz" @click="gocard()">
<text>立即充值</text> <text>立即充值</text>
@ -30,30 +34,48 @@
<!-- 囤油卡 --> <!-- 囤油卡 -->
<view class="xyihang"> <view class="xyihang">
<view class="title-hei">囤油卡</view> <view class="title-hei">囤油卡</view>
<view class="">
<text>下一张</text>
<uni-icons type="refreshempty" color="#2979ff" size="20"></uni-icons>
<view class="d_dis">
<view class="" @click="s_()">
<text>上一张</text>
<uni-icons type="reload" color="#2979ff" size="20"></uni-icons>
</view>
<view class="" @click="x_()">
<text>下一张</text>
<uni-icons type="refreshempty" color="#2979ff" size="20"></uni-icons>
</view>
</view> </view>
</view> </view>
<view class="card-ty"> <view class="card-ty">
<view class="card-top"> <view class="card-top">
<view class="cardimg"> <view class="cardimg">
<image src="../../static/imgs/jyzb.png" mode=""></image> <image src="../../static/imgs/jyzb.png" mode=""></image>
</view> </view>
<text style="color: #ffffff;">油站名称</text> <!-- <text style="color: #ffffff;">油站名称</text> -->
</view> </view>
<view style="width: 100%;display: flex;align-items: center;justify-content: space-between; "> <view style="width: 100%;display: flex;align-items: center;justify-content: space-between; ">
<view class="bai-box"> <view class="bai-box">
<view class="title-card">囤油卡</view> <view class="title-card">囤油卡</view>
<view class="">卡券卡密</view> <view class="">{{cardsList[cardsIndex].type}}:{{cardsList[cardsIndex].oilType}} </view>
<view style="lins"> **** **** **** 970 </view> <!-- <view style="lins"> **** **** **** 970 </view> -->
</view> </view>
<view class=""> <view class="">
<uni-icons type="eye-slash-filled" color="#ffffff" size="30" <uni-icons type="eye-slash-filled" color="#ffffff" size="30"
style="margin-right: 15px;"></uni-icons> style="margin-right: 15px;"></uni-icons>
</view> </view>
</view> </view>
<view class="anniu-cz" @click="gocard()">
<text>立即充值</text>
</view>
</view> </view>
<!-- 礼品卡 --> <!-- 礼品卡 -->
<view class="xyihang"> <view class="xyihang">
@ -68,21 +90,23 @@
<view class="cardimg"> <view class="cardimg">
<image src="../../static/imgs/jyzb.png" mode=""></image> <image src="../../static/imgs/jyzb.png" mode=""></image>
</view> </view>
<text style="color: #ffffff;">油站名称</text> <!-- <text style="color: #ffffff;">油站名称</text> -->
</view> </view>
<view style="width: 100%;display: flex;align-items: center;justify-content: space-between; "> <view style="width: 100%;display: flex;align-items: center;justify-content: space-between; ">
<view class="bai-box"> <view class="bai-box">
<view class="title-card">礼品卡</view> <view class="title-card">礼品卡</view>
<view class="">券卡密</view> <view class="">:454545578545</view>
<view style="lins"> **** **** **** 970 </view> <view style="lins"> 卡密: **** **** **** 970 </view>
</view> </view>
<view class=""> <view class="">
<uni-icons type="eye-slash-filled" color="#ffffff" size="30" <uni-icons type="eye-slash-filled" color="#ffffff" size="30"
style="margin-right: 15px;"></uni-icons> style="margin-right: 15px;"></uni-icons>
</view> </view>
</view> </view>
<view class="anniu-cz" @click="gocard()">
<text>立即兑换</text>
</view>
</view> </view>
@ -91,15 +115,23 @@
</template> </template>
<script> <script>
import request from "../../utils/request";
export default { export default {
data() { data() {
return { return {
cardBalance: 0.00,
cardsList: [],
cardsIndex: 0,
title: '', title: '',
} }
}, },
components: { components: {
},
onShow() {
this.getCardFuleRecords();
this.getUserBalance()
}, },
methods: { methods: {
gocard() { gocard() {
@ -107,6 +139,59 @@
url: '/pagesHome/oilRecharge/oilRecharge' url: '/pagesHome/oilRecharge/oilRecharge'
}) })
}, },
s_() {
if (this.cardsIndex == 0) {
uni.showToast({
title: '没有上一张了',
icon: 'error'
})
return
}
this.cardsIndex--
},
x_() {
if (this.cardsIndex < this.toil) {
this.cardsIndex++
} else {
uni.showToast({
title: '没有下一张了哦',
icon: 'error'
})
}
},
getCardFuleRecords() {
request({
url: 'business/marketingActivity/cardFuelRecord/queryByPageApplet',
method: 'get',
}).then(res => {
console.log(res)
if (res.code == 200) {
this.cardsList = res.data.records
if (this.cardsList.length != 0) {
this.toil = this.cardsList.length - 1
} else {
this.toil = this.cardsList.length
}
console.log(this.toil);
}
})
},
getUserBalance() {
request({
url: '/business/userManager/user/getUserBalance',
method: 'get',
}).then(res => {
console.log(res)
if (res.code == 200) {
this.cardBalance = res.data.cardBalance
}
})
},
goback() { goback() {
uni.navigateBack() uni.navigateBack()
} }
@ -147,6 +232,11 @@
top: 0px; top: 0px;
} }
.d_dis {
display: flex;
align-items: center;
}
.card-cz { .card-cz {
width: 90%; width: 90%;
border-radius: 8px; border-radius: 8px;

View File

@ -204,10 +204,6 @@
}, },
godetails(data) { godetails(data) {
// uni.$emit('goodsInfo', data)
// uni.$on('goodsInfo', res => {
// // console.log("myArray123", res)
// })
uni.$on('un', function() { uni.$on('un', function() {
uni.$emit('goodsInfo', data) uni.$emit('goodsInfo', data)

View File

@ -181,7 +181,7 @@
title: '囤油充值' title: '囤油充值'
}, },
{ {
title: '礼品卡充值' title: '礼品卡兑换'
}, },
], ],