1.修改话费积分抵扣

yj-dev
杨杰 3 years ago
parent dece3803d4
commit 14c61d02f7
  1. 16
      App.vue
  2. 8
      Utils/Api.js
  3. 372
      components/cj-slider/cj-slider.vue
  4. 2
      pages/goods/refuel-confirm/refuel-confirm.vue
  5. 23
      subPages/recharge-centre/recharge-centre.vue
  6. 371
      subPages/unionComfirmation/unionComfirmation.vue

@ -5,15 +5,15 @@
// brestUrl: 'http://192.168.3.4:9302/brest', // brestUrl: 'http://192.168.3.4:9302/brest',
// imgUrl: 'https://192.168.3.4:9301/filesystem/', // imgUrl: 'https://192.168.3.4:9301/filesystem/',
// //
url: 'https://hsg.dctpay.com/crest', // url: 'https://hsg.dctpay.com/crest',
imgUrl: 'https://hsg.dctpay.com/filesystem/', // imgUrl: 'https://hsg.dctpay.com/filesystem/',
brestUrl : 'https://hsg.dctpay.com/brest', // brestUrl : 'https://hsg.dctpay.com/brest',
imageWxImg:'https://hsg.dctpay.com/filesystem/wxApplets/', // imageWxImg:'https://hsg.dctpay.com/filesystem/wxApplets/',
// //
// url: 'https://hsgcs.dctpay.com/crest', url: 'https://hsgcs.dctpay.com/crest',
// brestUrl : 'https://hsgcs.dctpay.com/brest', brestUrl : 'https://hsgcs.dctpay.com/brest',
// imgUrl: 'https://hsgcs.dctpay.com/filesystem/', imgUrl: 'https://hsgcs.dctpay.com/filesystem/',
// imageWxImg:'https://hsgcs.dctpay.com/filesystem/wxApplets/', imageWxImg:'https://hsgcs.dctpay.com/filesystem/wxApplets/',
userInfo: "", userInfo: "",
brestUserInfo : '', brestUserInfo : '',
openId: '', openId: '',

@ -430,8 +430,12 @@ export const oilCardPay = params => {
} }
//话费充值查询 //话费充值查询
export const getListOutRechargePrice = params => { export const getListOutRechargePrice = params => {
return POST('GET', `${base}/outRechargePrice/getListOutRechargePrice`, params).then(res => res.data); return POST('GET', `${base}/outRechargePrice/getRechargePriceByList`, params).then(res => res.data);
} }
//查询话费详情
export const findById = params => {
return POST('GET', `${base}/outRechargePrice/findById`, params).then(res => res.data);
}
//提交订单 //提交订单
export const orderToUNionPay = params => { export const orderToUNionPay = params => {
return POST('POST', `${base}/outRechargeOrder/orderToPay`, params).then(res => res.data); return POST('POST', `${base}/outRechargeOrder/orderToPay`, params).then(res => res.data);

@ -0,0 +1,372 @@
<template>
<view class="cj-slider" @mousemove="onSliMouseMove" @mouseup="onSliMouseUp">
<view class="mouse-move" :style="{height: moveHeight + 'rpx'}"></view>
<view class="cj-slider__line" :class="[disabled ? 'cj-slider--disabled' : '']" :style="{
backgroundColor: inactiveColor,
height: height + 'rpx'
}" style="border-radius: 8px;" ></view>
<view class="cj-slider__gap" :style="[
barStyle,
{
height: height + 'rpx',
backgroundColor: activeColor
}
]" style="border-radius: 8px;">
<!-- <view class="cj-slider__button-wrap" @mousedown="onMouseDown(1, $event)" @mousemove="onMouseMove($event)"
@mouseleave="onMouseLeave(1)" @mouseup="onMouseUp(1)" @touchstart="onTouchStart(1, $event)"
@touchmove="onTouchMove(1, $event)" @touchend="onTouchEnd(1)" @touchcancel="onTouchEnd">
<slot v-if="$slots.default || $slots.$default" />
<view v-else class="cj-slider__button" :style="[blockStyle, {
height: blockWidth + 'rpx',
width: blockWidth + 'rpx',
backgroundColor: blockColor
}]"></view>
</view> -->
<view class="cj-slider__button-wrap2" @mousedown="onMouseDown(2, $event)" @mousemove="onMouseMove($event)"
@mouseleave="onMouseLeave(2)" @mouseup="onMouseUp(2)" @touchstart="onTouchStart(2, $event)"
@touchmove="onTouchMove(2, $event)" @touchend="onTouchEnd(2)" @touchcancel="onTouchEnd">
<slot v-if="$slots.default || $slots.$default" />
<view v-else class="cj-slider__button" :style="[blockStyle, {
height: blockWidth + 'rpx',
width: blockWidth + 'rpx',
backgroundColor: blockColor
}]"></view>
</view>
</view>
</view>
</template>
<script>
/**
* slider 滑块选择器
* @property {Number | String} value 滑块默认值默认[最小值,最大值]
* @property {Number | String} min 最小值默认0
* @property {Number | String} max 最大值默认100
* @property {Number | String} step 步长默认1
* @property {Number | String} blockWidth 滑块宽度高等于宽30
* @property {Number | String} height 滑块条高度单位rpx默认6
* @property {String} inactiveColor 底部条背景颜色默认#c0c4cc
* @property {String} activeColor 底部选择部分的背景颜色默认#2979ff
* @property {String} blockColor 滑块颜色默认#ffffff
* @property {Object} blockStyle 给滑块自定义样式对象形式
* @property {Boolean} disabled 是否禁用滑块(默认为false)
* @property {Number | String} moveHeight 鼠标离开滑块仍可滑动的区域高度单位rpx(默认100)
* @event {Function} start 滑动触发
* @event {Function} moving 正在滑动中
* @event {Function} end 滑动结束
* @example <cj-slider v-model="value" />
*/
export default {
name: 'cj-slider',
props: {
//
value: {
type: Array,
default: []
},
//
disabled: {
type: Boolean,
default: false
},
// rpx
blockWidth: {
type: [Number, String],
default: 30
},
//
min: {
type: [Number, String],
default: 0
},
//
max: {
type: [Number, String],
default: 100
},
//
step: {
type: [Number, String],
default: 1
},
// rpx
height: {
type: [Number, String],
default: 20
},
//
activeColor: {
type: String,
default: '#f3b43f'
},
//
inactiveColor: {
type: String,
default: '#f5f6f4'
},
//
blockColor: {
type: String,
default: '#ffffff'
},
//
blockStyle: {
type: Object,
default () {
return {};
}
},
//
moveHeight: {
type: [Number, String],
default: '60'
}
},
data() {
return {
mouseLeave: false, //
mouseType: 1, // 1 2
mouseDown: false, //
startX: 0,
status: 'end',
newValue: 0,
distanceX: 0,
startValue: 0,
barStyle: {},
sliderRect: {
left: 0,
width: 0
}
};
},
created() {
// 2,[, ]
if (Object.prototype.toString.call(this.value) == '[object Array]' && this.value.length === 2) {
this.updateValue(this.value[0], this.value[1], false);
} else {
this.$emit('input', Array(this.min, this.max))
}
},
mounted() {
//
this.$uGetRect('.cj-slider').then(rect => {
this.sliderRect = rect;
});
},
methods: {
onTouchStart(type, event) {
if (this.disabled) return;
this.startX = 0;
//
let touches = event.touches[0];
//
this.startX = touches.clientX;
// this.valueprops$emit('input')
this.startValue = type === 1 ? this.format(this.value[0]) : this.format(this.value[1]);
//
this.status = 'start';
},
onMouseDown(type, event) {
if (this.disabled) return;
this.mouseDown = true;
this.mouseType = type
this.startX = event.clientX || 0;
this.startValue = type === 1 ? this.format(this.value[0]) : this.format(this.value[1]);
this.status = 'start';
},
onTouchMove(type, event) {
if (this.disabled) return;
//
// statusmoving
if (this.status == 'start') this.$emit('start');
let touches = event.touches[0]
//
this.distanceX = touches.clientX - this.sliderRect.left
//
// step
this.newValue = (this.distanceX / this.sliderRect.width) * (this.max - this.min) + this.min
this.status = 'moving'
// moving
this.$emit('moving');
if (type === 1) {
this.updateValue(this.newValue, this.format(this.value[1]), true);
} else {
this.updateValue(this.format(this.value[0]), this.newValue, true);
}
},
onMouseMove(event) {
if (!this.mouseDown) return;
if (this.disabled) return;
if (this.status == 'start') this.$emit('start');
//
this.distanceX = event.clientX - this.sliderRect.left
//
// step
this.newValue = (this.distanceX / this.sliderRect.width) * (this.max - this.min) + this.min
this.status = 'moving'
// moving
this.$emit('moving');
if (this.mouseType === 1) {
this.updateValue(this.newValue, this.format(this.value[1]), true);
} else {
this.updateValue(this.format(this.value[0]), this.newValue, true);
}
},
onMouseLeave(type) {
this.mouseLeave = true
},
onTouchEnd(type) {
if (this.disabled) return;
if (this.status === 'moving') {
if (type === 1) {
this.updateValue(this.newValue, this.format(this.value[1]), true);
} else {
this.updateValue(this.format(this.value[0]), this.newValue, true);
}
this.$emit('end');
}
this.status = 'end';
},
onMouseUp(type) {
this.mouseDown = false;
this.mouseLeave = false;
if (this.disabled) return;
if (this.status === 'moving') {
if (type === 1) {
this.updateValue(this.newValue, this.format(this.value[1]), true);
} else {
this.updateValue(this.format(this.value[0]), this.newValue, true);
}
this.$emit('end');
}
this.status = 'end';
},
onSliMouseUp() {
//
this.mouseDown = false;
this.mouseLeave = false;
},
onSliMouseMove(e) {
// PC
if (!this.mouseDown) return;
if (!this.mouseLeave) return;
this.onMouseMove(e)
},
updateValue(value, value2, drag) {
// step
const widthB1 = this.format(value)
const widthB2 = this.format(value2)
const widthB1B = Math.round((widthB1 - this.min) * 100 / (this.max - this.min))
const widthB2B = Math.round((widthB2 - this.min) * 100 / (this.max - this.min))
// max100
if (widthB1 > widthB2 || widthB2 > this.max || widthB2B > 100) return;
//
let barStyle = {
width: widthB2B - widthB1B + '%',
left: widthB1B + '%',
};
//
if (drag == true) {
barStyle.transition = 'none';
} else {
// css
delete barStyle.transition;
}
// value使change使input H5
this.$emit('input', Array(widthB1, widthB2));
this.barStyle = barStyle;
},
format(value) {
//
return Math.round(Math.max(this.min, Math.min(value, this.max)) / this.step) * this.step;
},
onClick(event) {
if (this.disabled) return;
// onTouchMove
const widthB1 = this.value[0]
const widthB2 = this.value[1]
const value = this.format(((event.detail.x - this.sliderRect.left) / this.sliderRect.width) * (this.max - this
.min) +
this.min);
if (value < widthB1 || (value - widthB1) <= (widthB2 - value)) {
// || =>
this.updateValue(value, widthB2, false)
} else {
// || =>
this.updateValue(widthB1, value, false)
}
},
$uGetRect(selector, all) {
// $uGetRectuView
return new Promise(resolve => {
uni.createSelectorQuery().
in(this)[all ? 'selectAll' : 'select'](selector)
.boundingClientRect(rect => {
if (all && Array.isArray(rect) && rect.length) {
resolve(rect)
}
if (!all && rect) {
resolve(rect)
}
})
.exec()
})
},
}
};
</script>
<style lang="scss" scoped>
.cj-slider {
position: relative;
// background-color: #ebedf0;
&__line {
position: absolute;
width: 100%;
background-color: #ebedf0;
}
&__gap {
position: relative;
// bug
// transition: width 0.2s;
background-color: #1989fa;
}
&__button {
width: 24px;
height: 24px;
border-radius: 50%;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
background-color: #fff;
cursor: pointer;
}
&__button-wrap {
position: absolute;
top: 50%;
left: 0;
transform: translate3d(-50%, -50%, 0);
}
&__button-wrap2 {
position: absolute;
top: 50%;
right: 0;
transform: translate3d(50%, -50%, 0);
}
}
.cj-slider--disabled {
opacity: 0.5;
}
.mouse-move {
position: fixed;
left: 0;
right: 0;
transform: translateY(-50%);
opacity: 0;
}
</style>

@ -144,7 +144,7 @@
<view class="width100 mart15 fcor333 font16 fontwig6 paddleft10">重要说明</view> <view class="width100 mart15 fcor333 font16 fontwig6 paddleft10">重要说明</view>
<view class="width95 paddleft10 font14 fcor999 mart5">1.<text <view class="width95 paddleft10 font14 fcor999 mart5">1.<text
class="fcor089 fontwig6">请先加油后下单</text>,即您到站后,与工作人员确认油号,号后再付款</view> class="fcor089 fontwig6">请先加油后下单</text>,即您到站后,与工作人员确认油号,号后再付款</view>
<view class="width95 paddleft10 font14 fcor999 mart5"> <view class="width95 paddleft10 font14 fcor999 mart5">
2.请勿先付款后加油,若您已下单付款请于24小时内到加油站完成加油;若您48小时内未完成加油,请及时发起退单;逾期退单可能会退单失败</view> 2.请勿先付款后加油,若您已下单付款请于24小时内到加油站完成加油;若您48小时内未完成加油,请及时发起退单;逾期退单可能会退单失败</view>
<view class="height80 width100"></view> <view class="height80 width100"></view>

@ -20,8 +20,8 @@
<view class="list"> <view class="list">
<view class="box" :class="{'on':item.id == inputAmountId}" v-for="(item,index) in amountList" :key="index" <view class="box" :class="{'on':item.id == inputAmountId}" v-for="(item,index) in amountList" :key="index"
@click="select(item)"> @click="select(item)">
<view class="heTitle">{{item.price}}</view> <view class="heTitle">{{item.rechargePrice}}</view>
<view class="font13 fcoreb5 fontwig6" v-if="item.status != 2 && item.discount != 100">{{item.discount}} </view> <view class="font13 fcoreb5 fontwig6" v-if="item.status != 2">{{item.payPrice}}</view>
<view class="font13 fcor999" v-if="item.status == 2">已售空</view> <view class="font13 fcor999" v-if="item.status == 2">已售空</view>
</view> </view>
</view> </view>
@ -135,7 +135,6 @@
inputAmount: '', inputAmount: '',
inputPhone: '', inputPhone: '',
amoutType: '', amoutType: '',
codesVlues: '',
amountList: [], amountList: [],
price: '', price: '',
amoutstatus: '', amoutstatus: '',
@ -204,8 +203,8 @@
}, },
methods: { methods: {
select(amoutinfos) { select(amoutinfos) {
this.inputAmount = amoutinfos.realPrice; this.inputAmount = amoutinfos.payPrice;
this.price = amoutinfos.price; this.price = amoutinfos.rechargePrice;
this.inputAmountId = amoutinfos.id; this.inputAmountId = amoutinfos.id;
this.amoutstatus = amoutinfos.status; this.amoutstatus = amoutinfos.status;
}, },
@ -239,9 +238,9 @@
showType = 1; showType = 1;
// #endif // #endif
let params = { let params = {
type: item, operatorType: item,
regionId: app.globalData.cityId, regionId: app.globalData.cityId,
showType: showType, platformId: showType,
rechargeType: this.swiperCurrent rechargeType: this.swiperCurrent
} }
getListOutRechargePrice(params).then(res => { getListOutRechargePrice(params).then(res => {
@ -291,14 +290,6 @@
}); });
return false; return false;
} }
// let params = {
// "orderPrice": this.inputAmount,
// "payPrice": this.inputAmount,
// "rechargeContent": this.inputPhone,
// "rechargeModel": this.amoutType,
// "agentKey": this.codesVlues,
// "objectId": this.inputAmountId,
// }
uni.showToast({ uni.showToast({
title: '提交订单...', title: '提交订单...',
icon: 'none', icon: 'none',
@ -307,7 +298,7 @@
uni.navigateTo({ uni.navigateTo({
url: '../unionComfirmation/unionComfirmation?orderPrice=' + that.price + url: '../unionComfirmation/unionComfirmation?orderPrice=' + that.price +
'&payPrice=' + that.inputAmount + '&rechargeContent=' + that.inputPhone + '&payPrice=' + that.inputAmount + '&rechargeContent=' + that.inputPhone +
'&rechargeModel=' + that.amoutType + '&agentKey=' + that.codesVlues + '&rechargeModel=' + that.amoutType +
'&objectId=' + that.inputAmountId + '&rechargeType=' + that.swiperCurrent '&objectId=' + that.inputAmountId + '&rechargeType=' + that.swiperCurrent
}) })
} }

@ -46,38 +46,65 @@
</view> </view>
<view class="width94 comorder mart10"> <view class="width94 comorder mart10">
<view class="height50 width100 backcorfff"> <!-- <view class="fotct paddtop20 fcor666 font14 fontspec" style="margin-left: 30%;">抵扣金额 : ¥{{priceValue[1] / 10 /10}}
<view class="width50 flleft fcor333 fontwig6 font16" style="padding-left: 4%;"> </view> -->
支付方式 <view class="width92 alijusstart paddtop20">
<view class="width30 fcor333 fontwig6 font16">
积分抵扣
</view>
<view class="cj-slider">
<view class="flleft fotct font14 fcor666" style="width: 15%;">0</view>
<cj-slider style="width: 60%; float:left;" v-model="priceValue" :min="0" :max="availIntegal"
:step="1" :blockWidth="40" @start="blockStart" @moving="blockMoving" @end="blockEnd" />
<view class="flright fotrt font14 fcor666" style="width: 25%;">{{availIntegal}}</view>
</view> </view>
</view> </view>
<view class="width94 line1 mart5 marb5"></view> <view class="width94 line1 mart15 marb5"></view>
<view class="height50 width100 backcorfff" @tap="paytype='jinbi'"> <view class="height50 width100 backcorfff">
<view class="width70 flleft fcor333 fontwig6 font16 text1" style="padding-left: 4%;"> <view class="width70 flleft fcor333 fontwig6 font16 text1" style="padding-left: 4%;">
积分支付<text class="font14 fcor666 margle">可用积分: {{user.gold}}</text> 抵扣金额
</view> </view>
<view class="width20 flright fotrt paddtright10 font15 fontwig6 fcor666 alijun" <view class="width20 flright fotrt paddtright10 font15 fontwig6 fcor666 alijun"
style="align-items: center;"> style="align-items: center;">
<radio :checked="paytype=='jinbi'" color="#0083f5" /> ¥{{priceValue[1] / 100}}
</view> </view>
</view> </view>
<view class="width94 line1 mart5 marb5"></view> <view class="width94 line1 mart5 marb5"></view>
<view class="height50 width100 backcorfff" @tap="paytype='weixin'"> <view class="height50 width100 backcorfff">
<view class="width50 flleft fcor333 fontwig6 font16" style="padding-left: 4%;"> <view class="width50 flleft fcor333 fontwig6 font16" style="padding-left: 4%;">
微信支付 支付方式
</view>
<view class="width40 flright fotrt paddtright10 font15 fontwig6 fcor666 alijun"
style="align-items: center;">
<radio :checked="paytype=='weixin'" color="#0083f5" />
</view> </view>
</view> </view>
<view class="height50 width100 backcorfff" @tap="paytype='gonghuika'"> <view class="width100" v-for="(item,index) in paytypeList" :key="index">
<view class="width70 flleft fcor333 fontwig6 font16 text1" style="padding-left: 4%;"> <!-- <view class="width94 line1 mart5 marb5"></view>
汇联通工会卡<text class="font14 fcor666 margle">可用余额: {{tongCardPrice}}</text> <view class="height50 width100 backcorfff" @tap="paytype='jinbi'">
<view class="width70 flleft fcor333 fontwig6 font16 text1" style="padding-left: 4%;">
积分支付<text class="font14 fcor666 margle">可用积分: {{user.gold}}</text>
</view>
<view class="width20 flright fotrt paddtright10 font15 fontwig6 fcor666 alijun"
style="align-items: center;">
<radio :checked="paytype=='jinbi'" color="#0083f5" />
</view>
</view> -->
<view class="width94 line1 mart5 marb5" v-if="item == 2"></view>
<view class="height50 width100 backcorfff" @tap="paytype='2'" v-if="item == 2">
<view class="width50 flleft fcor666 fontwig6 font16" style="padding-left: 4%;">
微信支付
</view>
<view class="width40 flright fotrt paddtright10 font15 fontwig6 fcor666 alijun"
style="align-items: center;" v-if="isUse">
<radio :checked="paytype=='2'" color="#0083f5" />
</view>
</view> </view>
<view class="width20 flright fotrt paddtright10 font15 fontwig6 fcor666 alijun" <view class="width94 line1 mart5 marb5" v-if="item == 3"></view>
style="align-items: center;"> <view class="height50 width100 backcorfff" @tap="paytype='3'" v-if="item == 3">
<radio :checked="paytype=='gonghuika'" @click="changeRiado()" color="#0083f5" /> <view class="width70 flleft fcor666 fontwig6 font16 text1" style="padding-left: 4%;">
汇联通工会卡<text class="font14 fcor666 margle">可用余额: {{tongCardPrice}}</text>
</view>
<view class="width20 flright fotrt paddtright10 font15 fontwig6 fcor666 alijun"
style="align-items: center;" v-if="isUse">
<radio :checked="paytype=='3'" @click="changeRiado()" color="#0083f5" />
</view>
</view> </view>
</view> </view>
</view> </view>
@ -85,12 +112,13 @@
<view class="width100 height60"></view> <view class="width100 height60"></view>
<view class="footer"> <view class="footer">
<view class="settlement"> <view class="settlement">
<view class="sum">实付:<view class="money" v-if="paytype == 'weixin' || paytype == 'gonghuika' "> <!-- v-if="paytype == '2' || paytype == '3' " -->
<view class="sum">实付:<view class="money">
{{payPrice}}</view> {{payPrice}}</view>
<view class="money aliitem" v-else> <!-- <view class="money aliitem" v-else>
<image style="width: 15px;height: 15px;vertical-align: sub;" src="../../static/img/jfx.png"> <image style="width: 15px;height: 15px;vertical-align: sub;" src="../../static/img/jfx.png">
</image>{{payPrice*100}} </image>{{payPrice*100}}
</view> </view> -->
</view> </view>
<!-- #ifdef MP --> <!-- #ifdef MP -->
<button class="btn" open-type="getPhoneNumber" v-if="user == null" <button class="btn" open-type="getPhoneNumber" v-if="user == null"
@ -136,9 +164,11 @@
hltUnionCardPayUnion, hltUnionCardPayUnion,
getHuiLianTongCardBalance, getHuiLianTongCardBalance,
loginByPhone, loginByPhone,
getUserOrderPreList getUserOrderPreList,
findById
} from '../../Utils/Api.js'; } from '../../Utils/Api.js';
import wybPopup from '../../components/wyb-popup/wyb-popup.vue'; import wybPopup from '../../components/wyb-popup/wyb-popup.vue';
import cjSlider from '../../components/cj-slider/cj-slider.vue';
import ssPaymentPassword from '../../components/sanshui-payment-password'; import ssPaymentPassword from '../../components/sanshui-payment-password';
let app = getApp(); let app = getApp();
// #ifdef H5 // #ifdef H5
@ -147,29 +177,20 @@
export default { export default {
components: { components: {
wybPopup, wybPopup,
cjSlider,
ssPaymentPassword ssPaymentPassword
}, },
data() { data() {
return { return {
buylist: [], // imageUrl: app.globalData.imgUrl,
goodsPrice: 0.0, // imagewxUrl: app.globalData.imageWxImg,
sumPrice: 0.0, //
freight: 12.00, //
note: '', //
int: 1200, //
deduction: 0, //
couponId: '',
couponList: [],
UserNormalDiscountList: [],
imageUrl: app.globalData.imgUrl,
imagewxUrl: app.globalData.imageWxImg,
imgadres1: 'arrive_time_img.jpeg', imgadres1: 'arrive_time_img.jpeg',
deductionPrice: '0.00', deductionPrice: '0.00',
paytheprice: '', paytheprice: '',
radioStatus: true, radioStatus: true,
memDiscountId: '', memDiscountId: '',
user: '', user: '',
paytype: 'weixin', paytype: '',
PaymentPassword: '', PaymentPassword: '',
orderId: '', orderId: '',
jumpType: '', jumpType: '',
@ -181,10 +202,15 @@
saveprice: 0, saveprice: 0,
rechargeContent: '', rechargeContent: '',
rechargeModel: '', rechargeModel: '',
agentKey: '',
objectId: '', objectId: '',
OrderPreList: [], OrderPreList: [],
reType: '' // reType: '', //
rechargeDes: '', //
paytypeList: [], //
priceValue: [0, 0], //
availIntegal: '', //
isUse: true, //
isIntegral: false //使
}; };
}, },
@ -194,15 +220,15 @@
this.saveprice = options.payPrice; this.saveprice = options.payPrice;
this.rechargeContent = options.rechargeContent; this.rechargeContent = options.rechargeContent;
this.rechargeModel = options.rechargeModel; this.rechargeModel = options.rechargeModel;
this.agentKey = options.agentKey;
this.objectId = options.objectId; this.objectId = options.objectId;
this.reType = options.rechargeType; this.reType = options.rechargeType;
}, },
onShow() { onShow() {
let that = this; let that = this;
that.paytype = 'weixin'; // that.paytype = '2';
that.user = app.globalData.userInfo; that.user = app.globalData.userInfo;
that.findUser(); that.findUser();
that.findById();
// #ifdef MP // #ifdef MP
that.getUserOrderPreList(); that.getUserOrderPreList();
// #endif // #endif
@ -211,6 +237,45 @@
}, },
methods: { methods: {
//
findById() {
uni.showLoading({
title: '加载中'
})
let showType;
// #ifdef H5
showType = 2;
// #endif
// #ifdef MP
showType = 1;
// #endif
let datas = {
platformId: showType,
id: this.objectId
}
findById(datas).then(res => {
if (res.return_code == '000000') {
uni.hideLoading();
this.rechargeDes = res.return_data;
this.paytypeList = res.return_data.productPayTypeString.split(',');
this.paytypeList = this.paytypeList.slice(0, this.paytypeList.length - 1);
if (res.return_data.integralDiscount == 100) {
let payprice = parseFloat(res.return_data.payPrice * 100).toFixed(0);
if (payprice > this.user.gold) {
// this.priceValue[1] = this.user.gold;
this.availIntegal = this.user.gold;
} else {
// this.priceValue[1] = payprice;
this.availIntegal = payprice;
}
} else {
let payprice1 = parseFloat(res.return_data.payPrice * 100).toFixed(0);
// this.priceValue[1] = payprice1;
this.availIntegal = payprice1;
}
}
});
},
// //
findUser() { findUser() {
let params; let params;
@ -266,26 +331,65 @@
this.memDiscountId = ''; this.memDiscountId = '';
this.payPrice = this.saveprice; this.payPrice = this.saveprice;
this.deductionPrice = '0.00'; this.deductionPrice = '0.00';
// this.priceValue[1] = parseFloat(this.saveprice * 100).toFixed(0);
this.availIntegal = parseFloat(this.saveprice * 100).toFixed(0);
this.priceCaluc(this.saveprice);
} else { // } else { //
this.memDiscountId = item.id; this.memDiscountId = item.id;
if (item.discountType == 1) { if (item.discountType == 1) {
// //
this.deductionPrice = item.discountPrice; this.deductionPrice = item.discountPrice;
this.payPrice = this.paytheprice - this.deductionPrice; let oldprice = this.paytheprice - this.deductionPrice;
this.availIntegal = parseFloat(oldprice * 100).toFixed(0);
// this.priceValue[1] = parseFloat(this.payPrice * 100).toFixed(0);
this.priceCaluc(oldprice);
} else if (item.discountType == 2) { } else if (item.discountType == 2) {
// //
this.deductionPrice = item.discountPrice; this.deductionPrice = item.discountPrice;
this.payPrice = this.paytheprice - this.deductionPrice; let oldprice = this.paytheprice - this.deductionPrice;
this.availIntegal = parseFloat(oldprice * 100).toFixed(0);
// this.priceValue[1] = parseFloat(this.payPrice * 100).toFixed(0);
this.priceCaluc(oldprice);
} else if (item.discountType == 3) { } else if (item.discountType == 3) {
// //
this.deductionPrice = parseFloat(this.paytheprice - (this.paytheprice * item.discountPrice)) this.deductionPrice = parseFloat(this.paytheprice - (this.paytheprice * item.discountPrice))
.toFixed(2); .toFixed(2);
this.payPrice = parseFloat(this.paytheprice * item.discountPrice).toFixed(2) let oldprice = parseFloat(this.paytheprice * item.discountPrice).toFixed(2);
this.availIntegal = parseFloat(oldprice * 100).toFixed(0);
// this.priceValue[1] = parseFloat(this.payPrice * 100).toFixed(0);
this.priceCaluc(oldprice);
} }
} }
this.$refs.popup.hide(); this.$refs.popup.hide();
}, },
//
priceCaluc(item) {
console.log('======' + item);
if (this.rechargeDes.integralDiscount == 100) {
let payprice = parseFloat(item * 100).toFixed(0);
if (payprice > this.user.gold) {
// this.priceValue[1] = this.user.gold;
this.availIntegal = this.user.gold;
if (this.isIntegral) {
this.payPrice = (parseFloat(this.availIntegal / 100).toFixed(0)) - (this.priceValue[1] / 100);
}else{
this.payPrice = parseFloat(this.availIntegal / 100).toFixed(0);
}
// this.payPrice = parseFloat(this.availIntegal / 100).toFixed(0);
// console.log('=====' + this.payPrice);
} else {
// this.priceValue[1] = payprice;
this.availIntegal = payprice;
this.payPrice = parseFloat(this.availIntegal / 100).toFixed(0);
}
} else {
let payprice1 = parseFloat(item * 100).toFixed(0);
// this.priceValue[1] = payprice1;
this.availIntegal = payprice1;
this.payPrice = item - parseFloat(this.availIntegal / 100).toFixed(0);
}
},
// //
loginByPhone(PhoneNumber) { loginByPhone(PhoneNumber) {
if (PhoneNumber.detail.iv == undefined) { if (PhoneNumber.detail.iv == undefined) {
@ -321,7 +425,7 @@
} }
}); });
}, },
toPay() { toPay() {
let that = this; let that = this;
if (that.paytype == '') { if (that.paytype == '') {
uni.showToast({ uni.showToast({
@ -330,66 +434,60 @@
duration: 2000 duration: 2000
}) })
return; return;
} }
// #ifdef H5 // #ifdef H5
uni.showLoading({ uni.showLoading({
title: '提交订单中...' title: '提交订单中...'
}) })
let params = { let params = {
"memDiscountId": that.memDiscountId, "memDiscountId": that.memDiscountId,
"orderPrice": that.orderPrice, "rechargeContent": that.rechargeContent,
"payPrice": that.payPrice, "goodsId": that.objectId,
"rechargeContent": that.rechargeContent, "integralNum": '',
"rechargeModel": that.rechargeModel, "password": ''
"agentKey": that.agentKey, }
"objectId": that.objectId, addOrderPay(params).then(res => {
"identificationCode": app.globalData.identificationCode if (res.return_code == '000000') {
} uni.hideLoading();
addOrderPay(params).then(res => { that.orderId = res.return_data.id;
if (res.return_code == '000000') { let params = {
uni.hideLoading(); "orderId": res.return_data.id,
that.orderId = res.return_data.id; "openId": app.globalData.openId,
let params = { "openIdType": 2
"orderId": res.return_data.id, }
"openId": app.globalData.openId, that.orderToUNionPay(params);
"openIdType": 2 } else {
} uni.hideLoading();
that.orderToUNionPay(params); uni.showToast({
} else { title: res.return_msg,
uni.hideLoading(); icon: 'none',
uni.showToast({ duration: 2000
title: res.return_msg, });
icon: 'none', }
duration: 2000 })
}); // #endif
}
})
// #endif
// #ifdef MP // #ifdef MP
uni.requestSubscribeMessage({ uni.requestSubscribeMessage({
tmplIds: ['ZO6kC3oJv0zj9QzL0htsF-mM9vAElcgPZEcUGglxsoU'], tmplIds: ['ZO6kC3oJv0zj9QzL0htsF-mM9vAElcgPZEcUGglxsoU'],
success(res) { success(res) {
uni.showLoading({ uni.showLoading({
title: '提交订单中...' title: '提交订单中...'
}) })
let params = { let params = {
"memDiscountId": that.memDiscountId, "memDiscountId": that.memDiscountId,
"orderPrice": that.orderPrice,
"payPrice": that.payPrice,
"rechargeContent": that.rechargeContent, "rechargeContent": that.rechargeContent,
"rechargeModel": that.rechargeModel, "goodsId": that.objectId,
"agentKey": that.agentKey, "integralNum": '',
"objectId": that.objectId, "password": ''
"identificationCode": app.globalData.identificationCode
} }
addOrderPay(params).then(res => { addOrderPay(params).then(res => {
if (res.return_code == '000000') { if (res.return_code == '000000') {
uni.hideLoading(); uni.hideLoading();
that.orderId = res.return_data.id; that.orderId = res.return_data.id;
let params = { let params = {
"orderId": res.return_data.id, "orderId": res.return_data.id,
"openId": app.globalData.openId "openId": app.globalData.openId
} }
that.orderToUNionPay(params); that.orderToUNionPay(params);
} else { } else {
uni.hideLoading(); uni.hideLoading();
@ -401,9 +499,8 @@
} }
}) })
}, },
fail(res) { fail(res) {},
}, })
})
// #endif // #endif
}, },
// //
@ -429,11 +526,11 @@
this.$refs.popup.show(); this.$refs.popup.show();
}, },
// //
orderToUNionPay(item) { orderToUNionPay(item) {
let that = this; let that = this;
if (that.paytype == 'weixin') { if (that.paytype == '2') {
orderToUNionPay(item).then(res => { orderToUNionPay(item).then(res => {
if (res.return_code == '000000') { if (res.return_code == '000000') {
// #ifdef MP // #ifdef MP
uni.showLoading({ uni.showLoading({
title: '支付中...' title: '支付中...'
@ -478,30 +575,32 @@
}) })
} }
}) })
} else if (that.paytype == 'jinbi') { }
if (that.user.gold < that.payPrice * 100) { // else if (that.paytype == 'jinbi') {
uni.showToast({ // if (that.user.gold < that.payPrice * 100) {
icon: 'none', // uni.showToast({
title: '积分不足', // icon: 'none',
duration: 2000, // title: '',
success() { // duration: 2000,
setTimeout(() => { // success() {
uni.navigateTo({ // setTimeout(() => {
url: '../../pages/user/deposit/deposit' // uni.navigateTo({
}) // url: '../../pages/user/deposit/deposit'
}, 1000) // })
} // }, 1000)
}); // }
return; // });
} // return;
if (!that.user.isSetPayPwd) { // }
uni.navigateTo({ // if (!that.user.isSetPayPwd) {
url: '../../pages/login/updatePas/updatePas' // uni.navigateTo({
}) // url: '../../pages/login/updatePas/updatePas'
return; // })
} // return;
that.$refs.paymentPassword.modalFun('show'); // }
} else if (that.paytype == 'gonghuika') { // that.$refs.paymentPassword.modalFun('show');
// }
else if (that.paytype == '3') {
if (that.tongCardPrice < that.payPrice) { if (that.tongCardPrice < that.payPrice) {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
@ -616,7 +715,7 @@
}, },
payRequest: function(self) { payRequest: function(self) {
let that = this; let that = this;
uni.showLoading({ uni.showLoading({
title: '支付中...' title: '支付中...'
}) })
@ -667,7 +766,29 @@
}); });
}); });
}, },
blockStart() {},
blockMoving() {
// console.log('')
},
blockEnd() {
console.log('=======' + this.priceValue[1]);
console.log('=======' + this.priceValue);
if (this.priceValue[1] > 0) {
this.isIntegral = true;
} else {
this.isIntegral = false;
}
this.payPrice = this.payPrice - parseFloat(this.priceValue[1] / 100).toFixed(0);
if (this.payPrice == 0) {
this.isUse = false;
this.paytype = '';
} else {
this.isUse = true;
}
// console.log('')
}
} }
} }
</script> </script>
@ -688,6 +809,12 @@
margin-top: 30rpx; margin-top: 30rpx;
} }
.cj-slider {
width: 100%;
align-items: center;
display: flex;
}
.goodsimg { .goodsimg {
align-items: center; align-items: center;
display: flex; display: flex;

Loading…
Cancel
Save