会员信息

This commit is contained in:
cun-nan 2023-12-27 18:44:56 +08:00
parent c9dbe51f22
commit 323add1517
13 changed files with 656 additions and 88 deletions

View File

@ -14,7 +14,11 @@ public class ReturnParameter {
*/
private String orderNo;
/**
* 响应报文
* 调起微信支付所需参数json形式的字符串
*/
private String reservedPayInfo;
/**
* 调起支付宝支付所需参数
*/
private String reservedTransactionId;
}

View File

@ -384,6 +384,7 @@ public class FyPayServiceImpl implements FyPayService {
ReturnParameter returnParameter = new ReturnParameter();
returnParameter.setOrderNo(receiveParameter.getOrderNo());
returnParameter.setReservedPayInfo(resMap.get("reserved_pay_info"));
returnParameter.setReservedTransactionId(resMap.get("reserved_transaction_id"));
res.put("data",returnParameter);
return res;

View File

@ -46,10 +46,18 @@ public class LJUserController extends BaseController {
return getSuccessResult(list);
}
/**
* 获取当前登录用户信息
* @return
*/
@GetMapping("/getUser")
public ResponseObject getUser(){
return getSuccessResult(userService.selectUserByUserId());
}
/**
* 根据storeId查询会员人数
*/
@GetMapping("/userNum")
public ResponseObject userNum(Integer storeId){
return getSuccessResult(userService.userNum(storeId));
@ -190,4 +198,14 @@ public class LJUserController extends BaseController {
public ResponseObject edit(@Validated @RequestBody LJUserVo user){
return getSuccessResult(userService.updateUser(user));
}
/**
* 修改会员信息
* @param user
* @return
*/
@PutMapping("/edit")
public ResponseObject editUser(@Validated @RequestBody LJUser user){
return getSuccessResult(userService.editUser(user));
}
}

View File

@ -22,6 +22,12 @@ public interface LJUserService extends IService<LJUser> {
Integer userNum(Integer storeId);
/**
* 查询当前登录的用户信息
* @return
*/
LJUser selectUserByUserId();
/**
* 查询所有会员信息
* @return
@ -85,6 +91,13 @@ public interface LJUserService extends IService<LJUser> {
*/
public int updateUser(LJUserVo user);
/**
* 登录用户修改会员信息自己修改
* @param user
* @return
*/
int editUser(LJUser user);
/**
* 等级清算规则
*/

View File

@ -63,6 +63,12 @@ public class LJUserServiceImpl extends ServiceImpl<LJUserMapper, LJUser> impleme
return baseMapper.selectCount(queryWrapper);
}
@Override
public LJUser selectUserByUserId() {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
return baseMapper.selectById(nowAccountInfo.getId());
}
/**
* 查询所有会员信息
* @return
@ -311,6 +317,11 @@ public class LJUserServiceImpl extends ServiceImpl<LJUserMapper, LJUser> impleme
return row;
}
@Override
public int editUser(LJUser user) {
return baseMapper.updateById(user);
}
@Override
public void clearRule() {
List<LJUserVo> list = this.selectUsersList();

View File

@ -1,8 +1,8 @@
# \u57FA\u672C\u914D\u7F6E
server.port=8008
server.port=8080
env.profile=dev
#env.properties.path=D:/workspaces/oilSystem/fuintBackend/configure/
env.properties.path=D:/code/oilSystem/fuintBackend/configure/
env.properties.path=D:/workspaces/oilSystem/fuintBackend/configure/
# \u6570\u636E\u5E93\u914D\u7F6E

View File

@ -1463,7 +1463,7 @@
_this.oilOrder.forEach(item => {
let discount = {type: "", full: 0, reduce: 0, liters: 0}
if (item.type == "汽油") {
let gasolineRule = JSON.parse(response.data.gasolineRule);
let gasolineRule = JSON.parse(response.data.gasolineRule).sort((a,b) => a.gasolineRule1 - b.gasolineRule1);
if (response.data.preferential == '自定义优惠' && response.data.status == 'qy') {
if (response.data.gasolineDiscount == "满减优惠") {
let oilDiscount = 0;
@ -1534,7 +1534,7 @@
}
}
if (item.type == "柴油") {
let dieselRule = JSON.parse(response.data.dieselRule);
let dieselRule = JSON.parse(response.data.dieselRule).sort((a,b) => a.dieselRule1 - b.dieselRule1);
if (response.data.preferential == '自定义优惠' && response.data.status == 'qy') {
if (response.data.dieselDiscount == "满减优惠") {
let oilDiscount = 0;
@ -1605,7 +1605,7 @@
}
}
if (item.type == "天然气") {
let naturalGasRule = JSON.parse(response.data.naturalGasRule);
let naturalGasRule = JSON.parse(response.data.naturalGasRule).sort((a,b) => a.naturalGasRule1 - b.naturalGasRule1);
if (response.data.preferential == '自定义优惠' && response.data.status == 'qy') {
if (response.data.naturalGasDiscount == "满减优惠") {
let oilDiscount = 0;

View File

@ -170,6 +170,13 @@
"navigationStyle": "custom"
}
},
{
"path": "editUser/index",
"style": {
"navigationBarTitleText": "修改用户信息",
"navigationStyle": "custom"
}
},
{
"path": "Coupons/Coupons",
"style": {

View File

@ -8,11 +8,12 @@
<view class="my-top">
<view class="dis-box">
<view class="dis">
<view class="touxiang" @click="gosetup">
<image src="../../static/imgs/myx.png" mode=""></image>
<view class="touxiang" @click="goSetup">
<image v-if="user.avatar!='' && user.avatar!=null && user.avatar!=undefined" :src="baseUrl + user.avatar" mode=""></image>
<image v-else src="../../static/imgs/myx.png" mode=""></image>
</view>
<view class="">
<view class="user-tel">135****7106</view>
<view class="user-tel" @click="goSetup">{{user.mobile}}</view>
<view class="user-name" @click="gorefuel">蓝鲸加油站总站<uni-icons type="right" color="#c1c1ff"
size="12"></uni-icons> </view>
</view>
@ -21,12 +22,12 @@
size="16"></uni-icons></view>
</view>
<view class="my-top-box">
<view class="jg-box" @click="gomony()">
<view class="jg-box" @click="goMony()">
<view class="jg-box-title">储值余额</view>
<view class="jg-box-nmb">{{cardBalance || 0 }}</view>
</view>
<text style="color: #999999;">|</text>
<view class="jg-box" @click="gooil()">
<view class="jg-box" @click="goOil()">
<view class="jg-box-title">囤油升数</view>
<view class="jg-box-nmb">{{refuelMoney[0].refuelMoney || 0 }}</view>
</view>
@ -37,14 +38,14 @@
<view class="jg-box-nmb">{{cardsList.length || 0 }}</view>
</view>
<text style="color: #999999;">|</text>
<view class="jg-box" style="border: none;" @click="gointegral()">
<view class="jg-box" style="border: none;" @click="goIntegral()">
<view class="jg-box-title">我的积分</view>
<view class="jg-box-nmb">{{myPoints || 0 }}</view>
</view>
</view>
</view>
<view class="my-top-box" style="margin-top: 45px;">
<view class="centenr-sx" @click="gomyorder(0)">
<view class="centenr-sx" @click="goMyOrder(0)">
<view class="centenr-img">
<image src="../../static/my/dingdan.png" mode=""></image>
</view>
@ -54,7 +55,7 @@
</view>
<view class="centenr-sx" @click="gomyorder(1)">
<view class="centenr-sx" @click="goMyOrder(1)">
<view class="centenr-img">
<image src="../../static/my/dsy.png" mode=""></image>
</view>
@ -63,7 +64,7 @@
</view>
</view>
<view class="centenr-sx" @click="gomyorder(2)">
<view class="centenr-sx" @click="goMyOrder(2)">
<view class="centenr-img">
<image src="../../static/my/ywc.png" mode=""></image>
</view>
@ -71,7 +72,7 @@
已完成
</view>
</view>
<view class="centenr-sx" @click="gomyorder(3)">
<view class="centenr-sx" @click="goMyOrder(3)">
<view class="centenr-img">
<image src="../../static/my/dpj.png" mode=""></image>
</view>
@ -91,7 +92,7 @@
礼品卡
</view>
</view>
<view class="centenr-sx" @click="gotodaby">
<view class="centenr-sx" @click="goToDaby">
<view class="centenr-img">
<image src="../../static/my/jryj.png" mode=""></image>
</view>
@ -101,7 +102,7 @@
</view>
<view class="centenr-sx" @click="gowriteoff()">
<view class="centenr-sx" @click="goWriteoff()">
<view class="centenr-img">
<image src="../../static/my/jl.png" mode=""></image>
</view>
@ -110,7 +111,7 @@
</view>
</view>
<view class="centenr-sx" @click="gorecharge()">
<view class="centenr-sx" @click="goRecharge()">
<view class="centenr-img">
<image src="../../static/my/chongzhi.png" style="width: 30px;height: 30px; "></image>
</view>
@ -118,7 +119,7 @@
充值记录
</view>
</view>
<view class="centenr-sx" @click="goinvte()">
<view class="centenr-sx" @click="goInvte()">
<view class="centenr-img">
<image src="../../static/my/lp.png" style="width: 30px;height: 30px; "></image>
</view>
@ -134,7 +135,7 @@
积分商城
</view>
</view>
<view class="centenr-sx" @click="gocard()">
<view class="centenr-sx" @click="goCard()">
<view class="centenr-img">
<image src="../../static/my/kb.png"></image>
</view>
@ -142,7 +143,7 @@
子卡管理
</view>
</view>
<view class="centenr-sx" @click="gofeedback()">
<view class="centenr-sx" @click="goFeedback()">
<view class="centenr-img">
<image src="../../static/my/yj.png"></image>
</view>
@ -170,7 +171,9 @@
cardBalance: 0.00,
title: '',
msg: "3",
// url
baseUrl: this.$baseUrl,
user:{},
}
},
@ -180,10 +183,23 @@
onShow() {
this.getUserBalance();
this.getGiftRecords();
this.getUserInfoList()
this.getUserInfoList();
this.getUser()
},
methods: {
gomyorder(id) {
//
getUser(){
request({
url: 'business/userManager/user/getUser',
method: 'get',
}).then(res => {
if (res.data != null && res.data != "" && res.data != undefined) {
this.user = res.data
this.user.mobile = res.data.mobile.slice(0,3) + "****" + res.data.mobile.slice(res.data.mobile.length-5,res.data.mobile.length-1)
}
})
},
goMyOrder(id) {
uni.navigateTo({
url: '/pagesMy/myorder/myorder?id=' + id
})
@ -193,27 +209,27 @@
url: '/pagesHome/RechargeRecords/RechargeRecords'
})
},
gotodaby() {
goToDaby() {
uni.navigateTo({
url: '/pagesMy/today/today'
})
},
gointegral() {
goIntegral() {
uni.navigateTo({
url: '/pagesMy/integral/integral'
})
},
gooil() {
goOil() {
uni.navigateTo({
url: '/pagesMy/oilBalance/oilBalance'
})
},
gomony() {
goMony() {
uni.navigateTo({
url: '/pagesMy/moneyBalance/moneyBalance'
})
},
gosetup() {
goSetup() {
uni.navigateTo({
url: '/pagesMy/setup/index'
})
@ -223,12 +239,12 @@
url: '/pagesRefuel/pagesRefuel/index'
})
},
gowriteoff() {
goWriteoff() {
uni.navigateTo({
url: '/pagesMy/writeOff/writeOff'
})
},
gorecharge() {
goRecharge() {
uni.navigateTo({
url: '/pagesMy/Recharge/Recharge'
})
@ -238,12 +254,12 @@
url: '/pagesHome/PointsMall/PointsMall'
})
},
goinvte() {
goInvte() {
uni.navigateTo({
url: '/pagesMy/invite/invite'
})
},
gocard() {
goCard() {
uni.navigateTo({
url: '/pagesMy/CardManagement/CardManagement'
})
@ -253,7 +269,7 @@
url: '/pagesMy/VIP/vip'
})
},
gofeedback() {
goFeedback() {
uni.navigateTo({
url: '/pagesMy/feedback/feedback'
})
@ -263,7 +279,6 @@
url: '/business/userManager/user/getUserBalance',
method: 'get',
}).then(res => {
// console.log(res,111222)
if (res.code == 200) {
this.cardBalance = res.data.cardBalance,
/* if (res.data.refuelMoney!=null && res.data.refuelMoney!=""){
@ -279,7 +294,6 @@
method: 'get',
params: this.query
}).then(res => {
// console.log(res)
if (res.code == 200) {
this.cardsList = res.data.records
}

View File

@ -92,7 +92,7 @@
<view class="box-oil2" :class=" {'xz' :sindex == index }"
v-for="(item,index) in staffList" :key="index"
@click="getSIndex(index,item.id)">
<text>{{item.realName}}员工</text>
<text>{{item.realName}}</text>
</view>
</view>
<tabbar></tabbar>
@ -555,6 +555,8 @@
}
.box-oil2 {
width: 28%;
height: 25px;
line-height: 25px;
display: flex;
align-items: center;
justify-content: center;

View File

@ -0,0 +1,282 @@
<template>
<view class="content">
<view class="container">
<view class="my-header">
<view class="my-icons" @click="goBack"> <uni-icons type="left" size="16"></uni-icons> </view>
<view class="my-text">{{title}}</view>
<view class="my-icons"></view>
</view>
<!-- 修改用户昵称 -->
<view v-if="editType == 0" class="pBox">
<u-form :model="form" ref="uForm">
<u-form-item label="昵称" prop="name">
<u-input v-model="form.name" clearable :border="false" placeholder="请填写昵称"/>
</u-form-item>
</u-form>
<view class="but-sub" @click="submit">提交保存</view>
</view>
<!-- 修改用户手机号 -->
<view v-if="editType == 1" class="pBox">
<u-form :model="form" ref="uForm">
<u-form-item label="手机号" prop="mobile" label-width="70px">
<u-input v-model="mobile" clearable :border="false" placeholder="请填写手机号"/>
</u-form-item>
<u-form-item label="验证码" prop="code" label-width="70px">
<u-input v-model="code" clearable :border="false" placeholder="请填写验证码"/>
<u-button slot="right" :disabled="isCode" size="mini" type="success" @click="getCode">{{codeText}}</u-button>
</u-form-item>
</u-form>
<view class="but-sub" @click="submit">保存变更</view>
</view>
<!-- 修改用户车牌号 -->
<view v-if="editType == 2" class="pBox">
<view></view>
<u-form :model="form" ref="uForm">
<u-form-item label="车牌号" prop="mobile" label-width="70px">
<u-input v-model="form.carNo" @focus="show = true" clearable :border="false" placeholder="请输入车牌号"/>
</u-form-item>
</u-form>
<view class="but-sub" @click="submit">保存</view>
</view>
<!-- <u-keyboard ref="uKeyboard" :tips="value" mode="number" @cancel="show = false" @confirm="submitAmount" -->
<!-- @change="valChange" @backspace="backspace" v-model="pic" :show="show" mode="car"></u-keyboard> -->
<u-keyboard ref="uKeyboard" mode="car" v-model="value" :show="show" @cancel="show = false"
@confirm="submitAmount" @change="valChange" @backspace="backspace" :tips="value"></u-keyboard>
</view>
</view>
</template>
<script>
import request from "../../utils/request";
export default {
data() {
return {
pic:0,
value:"",
show:false,
//
title: '修改昵称',
//
editType:2,
//
form:{},
//
mobile: "",
//
code:"",
codeText: '获取验证码',
//
isCode:false,
timestamp:60,
rules: {
name: [
{
required: true,message: '请填写昵称',
//
trigger: 'blur,change'
}
],
mobile: [
{ required: true, message: '请输入手机号', trigger: ['change','blur'], },
{
//
validator: (rule, value, callback) => {
// truefalse
// this.$u.test.mobile()truefalse
return this.$u.test.mobile(value);
},
message: '手机号码不正确',
// blurchange
trigger: ['change','blur'],
}
]
}
}
},
onLoad(e) {
this.editType = e.editType
if (this.editType == 0){
this.title = "修改昵称"
}else if(this.editType == 1){
this.title = "修改手机号"
}else if(this.editType == 2){
this.title = "我的车"
}else{
this.title = "支付密码"
}
},
// onReadyonLoad
onReady() {
// this.$refs.uForm.setRules(this.rules);
},
onShow() {
this.getUser()
},
components: {
},
methods: {
//
submitAmount(){
if (this.value!=""){
this.show = false
}else{
uni.showToast({
title:"请输入车牌号",
icon:"error"
})
}
},
valChange(val) {
//
uni.vibrateShort({
success: function () {}
});
// value+=
this.value += val;
this.form.carNo += val;
},
// 退
backspace() {
uni.vibrateShort({
success: function () {}
});
// value
if (this.value.length) {
this.value = this.value.substr(0, this.value.length - 1);
this.form.carNo = this.value
}
},
// 60s
countdown(){
let _this = this
setInterval(() => {
// countdown1
_this.timestamp--;
_this.codeText = _this.timestamp+"秒重新获取"
// 0
if(_this.timestamp === 0) {
_this.isCode = false
_this.timestamp = 60
}
}, 1000);
},
//
getCode() {
this.isCode = true
//
this.countdown()
},
//
getUser(){
request({
url: 'business/userManager/user/getUser',
method: 'get',
}).then(res => {
if (res.data != null && res.data != "" && res.data != undefined) {
this.form = res.data
}
})
},
//
submit(){
// this.$refs.uForm.validate(valid => {
// if (valid) {
// console.log('');
request({
url: 'business/userManager/user/edit',
method: 'put',
data:this.form,
}).then(res => {
if (res.code == 200) {
uni.navigateTo({
url:"/pagesMy/setup/index"
})
}
})
// } else {
// console.log('');
// }
// });
},
goBack() {
uni.navigateBack()
}
}
}
</script>
<style scoped lang="scss">
.pBox{
width: 90%;
margin: 0 auto;
}
.but-sub{
width: 100%;
height: 45px;
line-height: 45px;
margin: 0 auto;
margin-top: 20px;
background-color: #2b7aff;
color: white;
border-radius: 10px;
text-align: center;
}
.content {
background: white;
}
.container {
width: 100%;
height: 100vh;
box-sizing: border-box;
padding-top: 88px;
}
.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;
.my-icons {
width: 20px;
}
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 10px;
border-bottom: 1px solid #f4f5f6;
}
.touxiang {
width: 50px;
height: 50px;
border-radius: 50%;
overflow: hidden;
// background-color: #f4f5f6;
}
.dis {
color: #a69999;
}
</style>

View File

@ -2,35 +2,42 @@
<view class="content">
<view class="container">
<view class="my-header">
<view class="my-icons" @click="goback"> <uni-icons type="left" size="16"></uni-icons> </view>
<view class="my-icons" @click="goBack"> <uni-icons type="left" size="16"></uni-icons> </view>
<view class="my-text">设置</view>
<view class="my-icons"></view>
</view>
<!-- 顶部区域 -->
<view class="box-hang">
<button class="box-hang" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
<view class="">头像</view>
<view class="touxiang"></view>
</view>
<view class="box-hang">
<view class="touxiang">
<image class="touxiang" v-if="user.avatar!='' && user.avatar!=null && user.avatar!=undefined" :src="baseUrl + user.avatar" mode=""></image>
<image class="touxiang" v-else src="@/static/imgs/myx.png" mode=""></image>
</view>
</button>
<view class="box-hang" @click="goEdit(0)">
<view class="">昵称</view>
<view class="dis"> <text>修改昵称</text> <uni-icons type="right" size="16"></uni-icons> </view>
<view class="dis">
<text v-if="user.name==''">未填写</text>
<text>{{user.name}}</text>
<uni-icons type="right" size="16"></uni-icons>
</view>
</view>
<view class="box-hang">
<view class="">手机号</view>
<view class="dis"> <text></text> <uni-icons type="right" size="16"></uni-icons> </view>
<view class="dis"> <text>{{user.mobile}}</text> <uni-icons type="right" size="16"></uni-icons> </view>
</view>
<view class="box-hang">
<view class="">会员</view>
<view class="dis"> <text></text> <uni-icons type="right" size="16"></uni-icons> </view>
<view class="">会员</view>
<view class="dis"> <text>{{user.userNo}}</text> <uni-icons type="right" size="16"></uni-icons> </view>
</view>
<view class="box-hang">
<view class="box-hang" @click="goEdit(2)">
<view class="">车牌号</view>
<view class="dis"> <text></text> <uni-icons type="right" size="16"></uni-icons> </view>
<view class="dis"> <text>{{user.carNo}}</text> <uni-icons type="right" size="16"></uni-icons> </view>
</view>
<view class="box-hang">
<!-- <view class="box-hang" @click="goEdit(3)">
<view class="">支付密码</view>
<view class="dis"> <text></text> <uni-icons type="right" size="16"></uni-icons> </view>
</view>
</view> -->
</view>
@ -38,20 +45,87 @@
</template>
<script>
import request from "../../utils/request";
import upload from '@/utils/upload.js'
export default {
data() {
return {
title: '',
//
user:{
//
avatar:"",
},
// url
baseUrl: this.$baseUrl,
}
},
onShow() {
this.getUser()
},
components: {
},
methods: {
goback() {
//
onChooseAvatar(e){
let _this = this;
let tempFilePath = e.detail.avatarUrl //
let maxSizeInBytes = 1024*1024 //
uni.getFileInfo({
filePath:tempFilePath,
success(res) {
let fileSize = res.size
if (fileSize > maxSizeInBytes){
uni.showToast({
title:"请上传小于1MB的图片",
icon:"error"
})
return
}
console.log(tempFilePath)
//
upload({
url: '/clientApi/file/upload',
filePath: tempFilePath,
}).then((res) => {
console.log('images', res.data.fileName);
_this.user.avatar = res.data.fileName
_this.editUser()
})
}
})
},
//
editUser(){
request({
url: 'business/userManager/user/edit',
method: 'put',
data:this.user,
}).then(res => {
if (res.code == 200) {
this.getUser()
}
})
},
//
goEdit(val){
uni.navigateTo({
url: '/pagesMy/editUser/index?editType=' + val,
})
},
//
getUser(){
request({
url: 'business/userManager/user/getUser',
method: 'get',
}).then(res => {
if (res.data != null && res.data != "" && res.data != undefined) {
this.user = res.data
}
})
},
goBack() {
uni.navigateBack()
}
}
@ -103,11 +177,11 @@
}
.touxiang {
width: 45px;
height: 45px;
width: 50px;
height: 50px;
border-radius: 50%;
overflow: hidden;
background-color: #f4f5f6;
// background-color: #f4f5f6;
}
.dis {

View File

@ -21,11 +21,11 @@
</view>
<view class="desc">
<view>加油金额</view>
<view>{{oilOrder.orderAmount}}</view>
<view>{{oilOrder.orderAmount}}</view>
</view>
<view class="desc">
<view>加油数量</view>
<view>{{oilOrder.oilNum}}L</view>
<view>{{oilOrder.oilNum}}</view>
</view>
<view class="desc">
<view>油品单价</view>
@ -58,10 +58,30 @@
</view>
</view>
<view class="desc">
<view class="desc" >
<view style="display: flex;">
满减活动优惠
<span style="display: flex;">(满减活动})</span>
</view>
<view style="display: flex;">
<span style="margin-right: 10px;">-{{fullRedece}}</span>
</view>
</view>
<view class="desc" >
<view style="display: flex;">
优惠券优惠
<span style="display: flex;">(优惠券)</span>
</view>
<view style="display: flex;">
<span style="margin-right: 10px;">-{{couponRedece}}</span>
</view>
</view>
<view class="desc" v-if="isGradePreferential">
<view style="display: flex;">
会员等级优惠
<span style="display: flex;">(会员等级)</span>
<span style="display: flex;">({{userGrade.name}})</span>
</view>
<view style="display: flex;">
<span style="margin-right: 10px;">-{{gradeRedece}}</span>
@ -109,6 +129,8 @@
export default {
data() {
return {
// WECHAT ALIPAY
appltType: "WECHAT",
gradeDis:"",
title: '',
value: true,
@ -137,7 +159,8 @@
gradeRedece:0,
fullRedece:0,
couponRedece:0,
hoardAmount:0,
//
deductAmount:0,
//
refuelMoney:[],
//
@ -154,11 +177,13 @@
isOilStorageCard:false,
// 使
isStoreValueCard:false,
// 使
isGradePreferential:false,
}
},
onLoad(e) {
// this.orderNo = e.orderNo
this.orderNo = "234520231226154037a1f53b"
this.orderNo = e.orderNo
// this.orderNo = "234520231226154037a1f53b"
},
onShow() {
this.getOilOrder();
@ -189,13 +214,13 @@
method: 'post',
data: map,
}).then(res => {
console.log(res)
// console.log(res)
let payProvider = "wxpay"
// if (_this.appltType== "WECHAT"){
// payProvider = "wxpay"
// }else{
// payProvider = "alipay"
// }
if (_this.appltType== "WECHAT"){
payProvider = "wxpay"
}else{
payProvider = "alipay"
}
if (res.data.reservedPayInfo!=null && res.data.reservedPayInfo!=""){
_this.orderInfo = JSON.parse(res.data.data.reservedPayInfo);
uni.requestPayment({
@ -212,7 +237,7 @@
//
paySign: _this.orderInfo.paySign,
success: function (res) {
console.log('success:',res);
console.log('success');
uni.reLaunch({
url: '/pagesRefuel/orderSuccess/index'
})
@ -271,6 +296,7 @@
})
if (falg == false) {
this.chooseCardBalance(0)
this.chooseGrade(this.user.gradeId)
}
},
// 使
@ -283,6 +309,7 @@
this.balanceRedece = this.oilOrder.orderAmount
} else {
this.balanceRedece = this.user.cardBalance
this.deductAmount = this.oilOrder.orderAmount - this.balanceRedece
this.payAmount = this.oilOrder.orderAmount - this.balanceRedece
}
}else{
@ -296,6 +323,8 @@
this.payAmount = (this.oilOrder.orderAmount - residueAmount - this.balanceRedece).toFixed(2)
}
}
}else{
this.deductAmount = this.oilOrder.orderAmount
}
},
// 使
@ -305,41 +334,155 @@
url: "business/userManager/userGrade/isUse/" + id,
method: 'get',
}).then((res) => {
console.log(res,that.oilType)
if (res.data != null && res.data != ""){
that.userGrade = res.data
if (res.data.preferential== "自定义优惠"){
if (that.oilType == "汽油"){
//
let gasolineRule = JSON.parse(res.data.gasolineRule).sort((a,b) => a.gasolineRule1 - b.gasolineRule1);
console.log(gasolineRule,222)
if (res.data.gasolineDiscount == "满减优惠"){
for (let i = 0; i<gasolineRule.length; i++){
if (that.oilOrder.orderAmount >= gasolineRule[gasolineRule.length-1].gasolineRule1){
that.gradeRedece = gasolineRule[gasolineRule.length-1].gasolineRule2
break;
if (gasolineRule.length > 1){
for (let i = 1; i<gasolineRule.length; i++){
if (that.deductAmount >= gasolineRule[gasolineRule.length-1].gasolineRule1){
that.gradeRedece = gasolineRule[gasolineRule.length-1].gasolineRule2
that.isGradePreferential = true
break;
}
if (that.deductAmount >= gasolineRule[i - 1].gasolineRule1 && that.deductAmount < gasolineRule[i].gasolineRule1) {
that.gradeRedece = gasolineRule[i - 1].gasolineRule2
that.isGradePreferential = true
}
}
if (item.amount >= gasolineRule[i - 1].gasolineRule1 && item.amount < gasolineRule[i].gasolineRule1) {
discount.full = gasolineRule[i - 1].gasolineRule1
oilDiscount = gasolineRule[i - 1].gasolineRule2
discount.reduce = gasolineRule[i - 1].gasolineRule2
}else{
if (that.deductAmount >= gasolineRule[gasolineRule.length-1].gasolineRule1){
that.gradeRedece = gasolineRule[gasolineRule.length-1].gasolineRule2
that.isGradePreferential = true
}
}
}
if (res.data.gasolineDiscount == "每升优惠"){
if (gasolineRule.length > 1){
for (let i = 1; i<gasolineRule.length; i++){
if (that.deductAmount >= gasolineRule[gasolineRule.length-1].gasolineRule1){
//
that.gradeRedece = (that.deductAmount/that.oilPrice * gasolineRule[gasolineRule.length-1].gasolineRule3).toFixed(2)
that.isGradePreferential = true
break;
}
if (that.deductAmount >= gasolineRule[i - 1].gasolineRule1 && that.deductAmount < gasolineRule[i].gasolineRule1) {
that.gradeRedece = (that.deductAmount/that.oilPrice * gasolineRule[i - 1].gasolineRule3).toFixed(2)
that.isGradePreferential = true
}
}
}else{
if (that.deductAmount >= gasolineRule[gasolineRule.length-1].gasolineRule1){
that.gradeRedece = (that.deductAmount/that.oilPrice * gasolineRule[gasolineRule.length-1].gasolineRule3).toFixed(2)
that.isGradePreferential = true
}
}
}
}
if (that.oilType == "柴油"){
//
let dieselRule = JSON.parse(res.data.dieselRule).sort((a,b) => a.dieselRule1 - b.dieselRule1);
if (res.data.dieselDiscount == "满减优惠"){
if (dieselRule.length > 1){
for (let i = 1; i<dieselRule.length; i++){
if (that.deductAmount >= dieselRule[dieselRule.length-1].dieselRule1){
that.gradeRedece = dieselRule[dieselRule.length-1].dieselRule2
that.isGradePreferential = true
break;
}
if (that.deductAmount >= dieselRule[i - 1].dieselRule1 && that.deductAmount < dieselRule[i].dieselRule1) {
that.gradeRedece = dieselRule[i - 1].dieselRule2
that.isGradePreferential = true
}
}
}else{
if (that.deductAmount >= dieselRule[dieselRule.length-1].dieselRule1){
that.gradeRedece = dieselRule[dieselRule.length-1].dieselRule2
that.isGradePreferential = true
}
}
}
if (res.data.dieselDiscount == "每升优惠"){
if (dieselRule.length > 1){
for (let i = 1; i<dieselRule.length; i++){
if (that.deductAmount >= dieselRule[dieselRule.length-1].dieselRule1){
//
that.gradeRedece = (that.deductAmount/that.oilPrice * dieselRule[dieselRule.length-1].dieselRule3).toFixed(2)
that.isGradePreferential = true
break;
}
if (that.deductAmount >= dieselRule[i - 1].dieselRule1 && that.deductAmount < dieselRule[i].dieselRule1) {
that.gradeRedece = (that.deductAmount/that.oilPrice * dieselRule[i - 1].dieselRule3).toFixed(2)
that.isGradePreferential = true
}
}
}else{
if (that.deductAmount >= dieselRule[dieselRule.length-1].dieselRule1){
that.gradeRedece = (that.deductAmount/that.oilPrice * dieselRule[dieselRule.length-1].dieselRule3).toFixed(2)
that.isGradePreferential = true
}
}
}
}
if (that.oilType == "天然气"){
//
let naturalGasRule = JSON.parse(res.data.naturalGasRule).sort((a,b) => a.naturalGasRule1 - b.naturalGasRule1);
if (res.data.naturalGasDiscount == "满减优惠"){
if (naturalGasRule.length > 1){
for (let i = 1; i<naturalGasRule.length; i++){
if (that.deductAmount >= naturalGasRule[naturalGasRule.length-1].naturalGasRule1){
that.gradeRedece = naturalGasRule[naturalGasRule.length-1].naturalGasRule2
that.isGradePreferential = true
break;
}
if (that.deductAmount >= naturalGasRule[i - 1].naturalGasRule1 && that.deductAmount < naturalGasRule[i].naturalGasRule1) {
that.gradeRedece = naturalGasRule[i - 1].naturalGasRule2
that.isGradePreferential = true
}
}
}else{
if (that.deductAmount >= naturalGasRule[naturalGasRule.length-1].naturalGasRule1){
that.gradeRedece = naturalGasRule[naturalGasRule.length-1].naturalGasRule2
that.isGradePreferential = true
}
}
}
if (res.data.naturalGasDiscount == "每升优惠"){
if (naturalGasRule.length > 1){
for (let i = 1; i<naturalGasRule.length; i++){
if (that.deductAmount >= naturalGasRule[naturalGasRule.length-1].naturalGasRule1){
//
that.gradeRedece = (that.deductAmount/that.oilPrice * naturalGasRule[naturalGasRule.length-1].naturalGasRule3).toFixed(2)
that.isGradePreferential = true
break;
}
if (that.deductAmount >= naturalGasRule[i - 1].naturalGasRule1 && that.deductAmount < naturalGasRule[i].naturalGasRule1) {
that.gradeRedece = (that.deductAmount/that.oilPrice * naturalGasRule[i - 1].naturalGasRule3).toFixed(2)
that.isGradePreferential = true
}
}
}else{
if (that.deductAmount >= naturalGasRule[naturalGasRule.length-1].naturalGasRule1){
that.gradeRedece = (that.deductAmount/that.oilPrice * naturalGasRule[naturalGasRule.length-1].naturalGasRule3).toFixed(2)
that.isGradePreferential = true
}
}
}
}
}
that.countPayMent()
}
})
},
//
countPayMent(){
this.payAmount = this.deductAmount - this.gradeRedece - this.fullRedece - this.couponRedece;
},
// id
getUser(id){
let _this = this;
@ -347,15 +490,14 @@
url: "business/userManager/user/" + id,
method: 'get',
}).then((res) => {
// console.log(res)
_this.user = res.data;
if (res.data.refuelMoney!=null && res.data.refuelMoney!=""){
_this.refuelMoney = JSON.parse(res.data.refuelMoney)
_this.chooseRefuelMoney()
}else{
_this.chooseCardBalance(0)
_this.chooseGrade(res.data.gradeId)
}
_this.chooseGrade(res.data.gradeId)
})
},
//