You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
high-mini/pages/order/confirmation.vue

1686 lines
46 KiB

4 years ago
<template>
<view>
3 years ago
<view class="width94 comorder mart10">
<view class="height100p width94 goodsimg">
<image class="flleft" mode="widthFix" v-if="couponList.couponImg" :src="imageUrl+couponList.couponImg"></image>
<view class="tcrig">
<view class="font18 fontwig6 fcor333 text1">{{couponList.couponName}}</view>
<view class="font13 fcor666 mart10">规格: 默认</view>
<view class="price-number mart10" v-if="isDiscont">
<view class="price font16">{{couponList.salesPrice}}</view>
<view class="flright fotrt paddleft10">x1</view>
</view>
<view class="price-number mart10" v-if="!isDiscont">
<view class="price font16">{{couponList.discountPrice}}</view>
<view class="number fcor666 font13 margle"
v-if="couponList.salesPrice != couponList.discountPrice">
{{couponList.salesPrice}}
</view>
<view class="flright fotrt paddleft10">x1</view>
</view>
</view>
</view>
<view class="width94 line1 mart5 marb5"></view>
<view class="height50 width100 backcorfff">
<view class="width50 flleft fcor333 fontwig6 font16" style="padding-left: 4%;">
商品总额
</view>
<view class="width40 flright fotrt paddtright10 font15 fontwig6 fcor999" v-if=" isDiscont">
{{couponList.salesPrice}}
</view>
<view class="width40 flright fotrt paddtright10 font15 fontwig6 fcor999" v-if="!isDiscont">
4 years ago
{{couponList.discountPrice}}
</view>
</view>
<view class="width94 line1 mart5 marb5"></view>
<view class="height50 width100 backcorfff">
<view class="width50 flleft fcor333 fontwig6 font16" style="padding-left: 4%;">
配送费
</view>
<view class="width40 flright alijun paddtright10 font15 fontwig6 fcor666">
0
</view>
</view>
<view class="width94 line1 mart5 marb5"></view>
<view class="height50 width100 backcorfff" @click="showPopup()">
<view class="width50 flleft fcor333 fontwig6 font16" style="padding-left: 4%;">
优惠抵扣<text class="yhqky">{{UserNormalDiscountList.length}}张可用</text>
</view>
<view class="width40 flright fotrt paddtright10 font15 fontwig6 fcor666 alijun"
style="align-items: center;" v-if="deductionPrice == 0">
未使用
<image style="width: 40rpx;height: 40rpx;" src="../../static/img/jt.png"></image>
</view>
<view class="width40 flright fotrt paddtright10 font15 fontwig6 fcoreb5 alijun"
style="align-items: center;" v-else>
-{{deductionPrice}}
<image style="width: 40rpx;height: 40rpx;" src="../../static/img/jt.png"></image>
</view>
</view>
</view>
<view class="width94 backcorfff mart10">
<view class="width94 alijusstart height50 font14 fcor666">
<view class="width40 fcor333 fontwig6 font16" style="padding-left: 2%;">邀请码</view>
<input class="width60 fotrt font15" v-model="identificationCode" placeholder="请输入邀请码" />
</view>
</view>
<!-- //实物配置 -->
<view class="width94 backcorfff mart10" v-if="couponList.wherePost">
<view class="width94 alijusstart height50 font14 fcor666 bor-botm1">
<view class="width40 fcor333 fontwig6 font16" style="padding-left: 2%;">联系人</view>
<input class="width60 fotrt font15" v-model="contactPepole" placeholder="请输入联系人" />
</view>
<view class="width94 alijusstart height50 font14 fcor666 bor-botm1">
<view class="width40 fcor333 fontwig6 font16" style="padding-left: 2%;">联系电话</view>
<input class="width60 fotrt font15" v-model="contactPhone" placeholder="请输入联系电话" />
</view>
<view class="width94 alijusstart height50 font14 fcor666">
<view class="width40 fcor333 fontwig6 font16" style="padding-left: 2%;">联系地址</view>
<input class="width60 fotrt font15" v-model="contactAddress" placeholder="请输入联系地址" />
</view>
</view>
<view class="width94 comorder mart10">
<view class="width92 alijusstart paddtop20" @touchmove.stop>
<view class=" fcor333 fontwig6 font16" style="flex-shrink: 0;padding-right: 15px;">
积分抵扣
</view>
<view class="cj-slider">
<!-- <view class="flleft fotct font14 fcor666" style="flex-shrink: 0;padding: 0 15px 0 0;">0</view> -->
<cj-slider class="flex-1" v-if="isDiscount" v-model="priceValue" :min="0"
:max="availIntegal" :step="1" :blockWidth="40" @start="blockStart" @moving="blockMoving"
@end="blockEnd" />
<view class="flright fotrt font14 fcor666" style="flex-shrink: 0;padding-left: 15px;">{{priceValue[1]}}/{{availIntegal}}</view>
</view>
</view>
<view class="width94 line1 mart15 marb5"></view>
<view class="height50 width100 backcorfff">
<view class="width70 flleft fcor333 fontwig6 font16 text1" style="padding-left: 4%;">
抵扣金额
</view>
<view class="width20 flright fotrt paddtright10 font15 fontwig6 fcor666 alijun"
style="align-items: center;">
¥{{priceValue[1] / 100}}
</view>
</view>
<view class="width94 line1 mart5 marb5"></view>
<view class="height40 width100 backcorfff" v-if="Integrastu == 1">
<view class="width40 flleft fcor666 font15 fontwig6 text1 alijusstart" style="padding-left: 2%;">
<image src="../../static/img/rebate.png" mode="widthFix" style="width: 25px;"></image>
<text>下单返积分</text>
</view>
<view class="width50 flright fotrt paddtright10 font15 colore95 alijun"
style="align-items: center;">
{{rebateIntegral}}积分
</view>
<!-- <view class="width50 flright fotrt paddtright10 font15 colore95 alijun" v-if="Integrastu == 2"
style="align-items: center;">
{{rebateIntegral}}
</view> -->
</view>
1 year ago
<view class=" width100 backcorfff alijusstart paddbotm10 border-box" style="padding-left: 2%;">
<image src="../../static/img/sigh.png" mode="widthFix" style="width:20px;height:20px"></image>
<text class="fcor999 font13">积分抵扣与优惠券抵扣不同享</text>
</view>
<view class="height40 width100 backcorfff">
<view class="height50 width100 backcorfff">
<view class="width100 flleft fcor333 fontwig6 font16" style="padding-left: 4%;">
支付方式
<!-- : <text class="jfrecharge" @click="jumpdeposits"
v-if="couponList.payType == 1 || couponList.payType == 2 || couponList.payType==3">积分充值</text> -->
</view>
</view>
</view>
<template v-if="payWeixin==2">
<view class="width94 line1 mart5 marb5"></view>
<view class="height50 width100 backcorfff">
<view class="width70 flleft fcor333 font16 text1" style="padding-left: 4%;">
<view class="dis-flex">
<image mode="aspectFit" :src="imageUrl+'payType/weixin.png'" style="width:30px;height:30px;"></image>
<text class="margle">微信</text>
</view>
</view>
<view class="width20 flright fotrt paddtright10 font15 fontwig6 fcor666 alijun"
style="align-items: center;" >
<radio :checked="paytype==2" color="#0083f5" />
</view>
</view>
</template>
<template v-else>
<view class="width100" v-for="(item,index) in paytypeList" :key="index">
<view class="width94 line1 mart5 marb5"></view>
<view class="height50 width100 backcorfff" @tap="paytype=item.payTypeId" >
<view class="width70 flleft fcor333 font16 text1" style="padding-left: 4%;">
<view class="dis-flex">
<image mode="aspectFit" v-if="item.payTypeLogo" :src="imageUrl+item.payTypeLogo" style="width:30px;height:30px;"></image>
<text class="margle">{{item.payTypeName}}</text>
<text class="font14 fcor666 margle" v-if="item.payTypeId == 3">可用余额: {{tongCardPrice}}</text>
<text class="font14 fcor666 margle" v-if="item.payTypeId == 6">可用余额: {{oilPirce}}</text>
<text class="font14 fcor666 margle" v-if="item.payTypeId == 7">可用余额: {{oilUserNoPrice}}</text>
</view>
</view>
<view class="width20 flright fotrt paddtright10 font15 fontwig6 fcor666 alijun"
style="align-items: center;" v-if="isUse">
1 year ago
<!--v-if="isUse" || (Number(paytheprice)==0&&item.payTypeId==8) -->
<template v-if="item.payTypeId == 3">
<radio :checked="paytype==item.payTypeId" @click="changeRiado()" color="#0083f5" />
</template>
<template v-else>
<radio :checked="paytype==item.payTypeId" color="#0083f5" />
</template>
</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 fcor333 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 class="width94 line1 mart5 marb5" v-if="item == 3"></view>
<view class="height50 width100 backcorfff" @tap="paytype='3'" v-if="item == 3">
<view class="width70 flleft fcor333 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 class="width94 line1 mart5 marb5" v-if="item == 6"></view>
<view class="height50 width100 backcorfff" @tap="paytype='6'" v-if="item == 6">
<view class="width70 flleft fcor333 font16 text1" style="padding-left: 4%;">
油卡支付<text class="font14 fcor666 margle">可用余额: {{oilPirce}}</text>
</view>
<view class="width20 flright fotrt paddtright10 font15 fontwig6 fcor666 alijun"
style="align-items: center;" v-if="isUse">
<radio :checked="paytype=='6'" color="#0083f5" />
</view>
</view>
<view class="width94 line1 mart5 marb5" v-if="item == 7"></view>
<view class="height50 width100 backcorfff" @tap="paytype='7'" v-if="item == 7">
<view class="width70 flleft fcor333 font16 text1" style="padding-left: 4%;">
车队油卡<text class="font14 fcor666 margle">可用余额: {{oilUserNoPrice}}</text>
</view>
<view class="width20 flright fotrt paddtright10 font15 fontwig6 fcor666 alijun"
style="align-items: center;" v-if="isUse">
<radio :checked="paytype=='7'" color="#0083f5" />
</view>
</view> -->
</view>
</template>
<view v-if="paytype=='7'" class="backcorfff">
<view class="heightl60 paddleft10 fcor333 fontwig6 font16 width100 backcorfff flleft">车队油卡列表</view>
<view class="line1"></view>
<view class="heightl60 paddleft10 fcor666 width100 backcorfff" v-for="(item,index) in oilUserCardlist"
:key="index">
<view class="width60 flleft font14">
{{item.cardNo}}({{item.contactName}})
</view>
<view class="flright width30 fotct">
<radio :checked="oilUserno==item.cardNo" @click="changeRiado1(item)" color="#0083f5" />
</view>
</view>
<view class="username">
<view class="namecont font15">车牌号</view>
<input style="width: 70%;" placeholder="输入车牌号" class="font15" v-model="cardNoNumber">
<!-- <view class="date text1" >{{cardNoNumber}}</view> -->
<!-- </view> -->
<picker mode="selector" style="width: 20%;" :range="UserCard" range-key="carLicensePlate"
@change="bindUserCard">
<view class="date text1"
style="color: white;position: absolute;margin-top: -2px;min-width: 100px;">
11111{{cardNoNumber}}</view>
</picker>
<image class="flright" style="width: 15px;height: 15px;" src="../../static/img/downj.png">
</image>
</view>
</view>
</view>
<view class="width100 height110"></view>
<view class="footer">
<view class="settlement">
<view class="sum">实付:<view class="money">{{paytheprice}}</view>
4 years ago
</view>
<!-- #ifdef MP -->
<button class="btn" open-type="getPhoneNumber" v-if="user == null || !user"
@getphonenumber="loginByPhone">立即支付</button>
<button class="btn" v-else @tap="toPay">立即支付</button>
<!-- #endif -->
<!-- #ifdef H5 -->
<button class="btn" v-if="user.phone == null || !user.phone" @click="jumpH5Bding">立即支付</button>
<button class="btn" v-else @tap="toPay">立即支付</button>
<!-- #endif -->
</view>
4 years ago
</view>
<wybPopup ref="popup" type="bottom" width="500" :scrollY="true" radius="6" :showCloseIcon="true">
<view class="fotct font18 fontwig6 fcor333 mart10 height30">优惠券选择</view>
<view class="width92 height110 tccs mart10" v-for="(items, index) in UserNormalDiscountList" :key="items"
@click="radioChanges(items)">
<image mode="widthFix" class="flleft" :src="imageUrl+items.discountImg"></image>
<view class="tcrig">
<view class="yhprice">
<radio :checked="items.id == memDiscountId" color="#0083f5" />
</view>
<view class="font16 fontwig6 fcor333 text1">{{items.discountName}}</view>
<view class="font13 fcor999 mart5">有效期至{{items.useEndTime | formatDate('-')}}</view>
</view>
</view>
</wybPopup>
<wybPopup ref="exchangeInstructions" type="center" @hide="closeInstructions" :height="getHeight" width="600" radius="6" :showCloseIcon="false">
<view class="font16">
<view class="fotct paddtop10 paddbotm10 border-b-666 fontwig6 foc3da7e7" >
兑换须知
</view>
<view class="pd-main">
<view class="marb5">
1.油券售出不可退换不同面额不能叠加使用
</view>
<view class="marb5">
2.消费额低于券额不找零高于券额需支付差额
</view>
<view class="marb5">
3.油券仅限中国石化贵州省内直营加油站点使用
</view>
<view class="marb5">
4.使用时请告知加油员使用汇联通电子券支付
</view>
</view>
<view class="mart30">
<view @click="toAgreeInstructions()" :class="'width65 needKnowBtn fotct fontwig6 '+(isFinish? ' active ' : 'nactive') " style="margin: 0 auto;">
我已阅读并同意<text class="marglerig" v-if="!isFinish">{{countDown}}s</text>
</view>
</view>
</view>
</wybPopup>
<ssPaymentPassword ref="paymentPassword" :mode="1" @submit="submitHandle" />
4 years ago
</view>
</template>
<script>
import {
2 years ago
create,
4 years ago
getCouponById,
loginByPhone,
getUserNormalDiscountList,
findUser,
cardPay,
2 years ago
getRebateIntegral,
getHuiLianTongCardBalance,
getThirdPartyByDetail,
wechatPay,
getUserCardList,
getCardListByCardNo
4 years ago
} from '../../Utils/Api.js';
import wybPopup from '../../components/wyb-popup/wyb-popup.vue';
2 years ago
import cjSlider from '../../components/cj-slider/cj-slider.vue';
import ssPaymentPassword from '../../components/sanshui-payment-password'
4 years ago
let app = getApp();
// #ifdef H5
var jweixin = require('jweixin-module');
// #endif
4 years ago
export default {
components: {
wybPopup,
ssPaymentPassword
},
4 years ago
data() {
return {
couponId: '',
couponList: [],
UserNormalDiscountList: [],
imageUrl: app.globalData.imgUrl,
deductionPrice: '0.00',
paytheprice: '', //支付金额
saveprice: '', //折扣价
orderPrice: '', //原价
4 years ago
radioStatus: true,
memDiscountId: '',
user: '',
paytype: '',
PaymentPassword: '',
orderId: '',
jumpType: '',
tongCardPrice: 0,
storeId: '',
isDiscont: false,
coupondiscountid: '',
orderDetails: '', //订单详情
payGold: '', //积分数
identificationCode: '', //渠道商
paytypeList: [], //支付方式
priceValue: [0, 0], // 积分可以指定默认值
changePrice: '', //滑动值
isDiscount: true,
availIntegal: 0, // 可用积分
isUse: true, // 是否禁用状态
rechargeDes: '', // 支付详情
rebateIntegral: '', //返回积分
Integrastu: 1, //返积分状态
contactPepole: '', //联系人
contactPhone: '', //联系电话
contactAddress: '', //联系地址
postPayType: '', //请求支付方式
oilUserCardlist: '', //油卡列表
oilPirce: 0, //油卡余额
oilUserno: '', //油卡卡号
contactName: '', //油卡联系人
oilUserNoPrice: 0, //油卡余额
UserCard: '', //车牌号列表
cardNoNumber: '', // 车牌号
getHeight:370,
countDown:3,
isFinish:false,
isAgree:false,//我已同意
Timer:null,
payWeixin:'',//固定微信支付
4 years ago
};
},
onLoad(option) {
this.couponId = option.id;
if (option.postPayType != undefined && option.postPayType) {
this.postPayType = option.postPayType;
}
if(option.type&&option.type==2){
this.payWeixin = 2;
this.paytype = 2;
}
// #ifdef H5
this.identificationCode = app.globalData.staffCode;
// #endif
// #ifdef MP
this.identificationCode = app.globalData.identificationCode;
// #endif
1 year ago
// this.getCouponById();
this.rpxTopx();
},
1 year ago
onShow() {
let that = this;
// that.paytype = '';
/* */
// that.user = app.globalData.userInfo;
/* */
1 year ago
// that.findUser();
this.getCouponById();
this.getUserCardList();
},
onHide() {
4 years ago
},
onBackPress() {
//页面后退时候,清除订单信息
},
filters: {
4 years ago
toFixed: function(x) {
return parseFloat(x).toFixed(2);
4 years ago
},
//过滤器 用于格式化时间
formatDate: function(value, spe = '/') {
let data = new Date(value);
let year = data.getFullYear();
let month = data.getMonth() + 1;
let day = data.getDate();
let h = data.getHours();
let mm = data.getMinutes();
let s = data.getSeconds();
month = month >= 10 ? month : "0" + month;
day = day >= 10 ? day : "0" + day;
h = h >= 10 ? h : "0" + h;
mm = mm >= 10 ? mm : "0" + mm;
s = s >= 10 ? s : "0" + s;
4 years ago
return `${year}${spe}${month}${spe}${day} ${h}:${mm}:${s}`;
}
},
methods: {
// px转rpx
rpxTopx() {
let deviceWidth = uni.getSystemInfoSync().windowWidth; //获取设备屏幕宽度
let rpx = (750 / deviceWidth) * Number(this.getHeight)
this.getHeight = Math.floor(rpx);
},
//查询支付方式
getThirdPartyByDetail() {
// #ifdef H5
this.showType = 2;
// #endif
// #ifdef MP
this.showType = 1;
// #endif
let datas = {
platformId: this.showType,
"companyId": this.couponList.companyId,
productType: 5,
productId: this.couponList.couponSource,
payType: this.postPayType
}
getThirdPartyByDetail(datas).then(res => {
if (res.return_code == '000000') {
this.rechargeDes = res.return_data;
// this.paytypeList = res.return_data.productPayType.split(',');
// this.paytypeList = this.paytypeList.slice(0, this.paytypeList.length - 1);
this.paytypeList = res.return_data.productPayTypeNew;
let zkprice = parseFloat(res.return_data.integralDiscount / 100).toFixed(2);
let pprice = parseFloat(this.paytheprice * 100).toFixed(0)
let payprice = parseFloat(this.paytheprice * 100 * zkprice).toFixed(
0);
if (payprice > this.user.gold) {
this.availIntegal = this.user.gold;
} else {
this.availIntegal = payprice;
}
/* 默认选第一个支付方式 */
if(this.paytypeList.length>0&&!this.payWeixin){
this.paytype = this.paytypeList[0].payTypeId;
if(this.paytype == 8){
if(this.isDiscount){
this.isDiscount = false;
this.$nextTick(()=>{
this.priceValue = [0,Number(this.availIntegal)];
this.isDiscount = true;
this.blockEnd();
// console.log(this.paytype,"11111111",this.priceValue);
})
}
}
}
}
});
2 years ago
},
//查询积分
findUser() {
let params;
findUser(params).then(res => {
if (res.return_code == '000000') {
app.globalData.userInfo = res.return_data;
this.user = res.return_data;
1 year ago
if (this.user.hltCardNo) {
this.getHuiLianTongCardBalance();
2 years ago
}
if (res.return_data.oilCard) {
this.oilPirce = res.return_data.oilCard.amount;
}
this.getUserNormalDiscountList();
this.getThirdPartyByDetail();
uni.setStorage({
key: "user",
data: res.return_data
})
}
});
},
//查询油卡包列表
getUserCardList() {
let datas = {
type: 3
}
getUserCardList(datas).then(res => {
if (res.return_code == '000000' && res.return_data != '') {
this.oilUserCardlist = res.return_data;
this.oilUserno = res.return_data[0].cardNo;
this.contactName = res.return_data[0].contactName;
this.oilUserNoPrice = res.return_data[0].balance;
this.getCardListByCardNo(res.return_data[0].cardNo);
}
});
},
//查询车牌号列表
getCardListByCardNo(item) {
let datas = {
cardNo: item
}
getCardListByCardNo(datas).then(res => {
if (res.return_code == '000000' && res.return_data != '') {
this.UserCard = res.return_data;
this.cardNoNumber = res.return_data[0].carLicensePlate;
} else {
this.UserCard = '';
this.cardNoNumber = '';
}
});
},
//选择车牌号
bindUserCard(e) {
this.cardNoNumber = this.UserCard[e.target.value].carLicensePlate;
},
//支付返利积分
getRebateIntegral() {
let datas = {
"companyId": this.couponList.companyId,
"price": this.paytheprice,
"type": 5,
}
getRebateIntegral(datas).then(res => {
if (res.return_code == '000000') {
this.rebateIntegral = res.return_data;
this.Integrastu = 1;
} else {
this.rebateIntegral = res.return_msg;
this.Integrastu = 2;
}
})
},
4 years ago
//查询卡券详情
getCouponById() {
uni.showLoading({
title: '加载中...'
})
let params = {
couponId: this.couponId
}
getCouponById(params).then(res => {
uni.hideLoading();
if (res.return_code == '000000') {
4 years ago
this.couponList = res.return_data;
this.paytheprice = res.return_data.discountPrice;
this.saveprice = res.return_data.discountPrice;
this.orderPrice = res.return_data.salesPrice;
this.getRebateIntegral();
1 year ago
this.findUser();
// this.getThirdPartyByDetail();
}
4 years ago
})
},
//显示弹出
showPopup() {
this.$refs.popup.show();
},
// 兑换说明弹出框
showPopupNeedKnow(){
this.$refs.exchangeInstructions.show();
if(this.Timer){
clearInterval(this.Timer);
}
if(!this.isFinish){
this.countDown = 3;
this.Timer = setInterval(()=>{
if(this.countDown == 0){
clearInterval(this.Timer);
this.isFinish = true;
return;
}
this.countDown--
},1000)
}
},
// 点击同意
toAgreeInstructions(){
if(this.isFinish){
this.isAgree = true;
this.$refs.exchangeInstructions.close();
1 year ago
this.toPay();
}
},
closeInstructions(){
if(this.Timer){
clearInterval(this.Timer);
}
},
//选择优惠券
radioChanges(item) {
this.paytheprice = this.orderPrice;
this.rechangeload();
if (this.memDiscountId == item.id) { // 如果已经选中,则取消选中
this.memDiscountId = '';
4 years ago
this.deductionPrice = '0.00';
this.priceCaluc(this.saveprice);
this.isDiscont = false;
} else { // 否则进行选中赋值
this.isDiscont = true;
if (item.discountType == 1) {
//满减价格
if (this.orderPrice >= item.discountCondition) {
this.memDiscountId = item.id;
//满减价格
this.deductionPrice = item.discountPrice;
let oldprice = this.orderPrice - this.deductionPrice;
this.priceCaluc(oldprice);
} else {
uni.showToast({
title: '请满' + item.discountCondition + '使用此券',
icon: 'none',
duration: 2000
})
}
}
if (item.discountType == 2) {
this.memDiscountId = item.id;
//抵扣价格
this.deductionPrice = item.discountPrice;
let oldprice = this.orderPrice - this.deductionPrice;
this.priceCaluc(oldprice);
}
if (item.discountType == 3) {
this.memDiscountId = item.id;
// 打折
this.deductionPrice = parseFloat(this.orderPrice - (this.orderPrice * item
.discountPrice))
.toFixed(2);
let oldprice = parseFloat(this.orderPrice * item.discountPrice).toFixed(2);
this.priceCaluc(oldprice);
}
}
this.$refs.popup.hide();
4 years ago
},
//计算价格
priceCaluc(item) {
let zkprice = parseFloat(this.rechargeDes.integralDiscount / 100).toFixed(2);//积分使用比例integralDiscount
let pprice = parseFloat(item * 100).toFixed(0);
let payprice = parseFloat(item * 100 * zkprice).toFixed(0);
if (payprice > this.user.gold) {
this.availIntegal = this.user.gold;
this.priceValue[1] = 0;
} else {
this.availIntegal = payprice;
this.priceValue[1] = 0;
}
this.reload();
this.calculatepayPrice();
},
//计算支付价格
calculatepayPrice() {
if (this.deductionPrice == 0) {
this.paytheprice = parseFloat(this.saveprice - (parseFloat(this.priceValue[1] / 100).toFixed(2)))
.toFixed(
2);
} else {
this.paytheprice = parseFloat(this.orderPrice - (parseFloat(this.priceValue[1] / 100).toFixed(2)) -
this
.deductionPrice).toFixed(2);
}
1 year ago
this.getRebateIntegral();
},
rechangeload() {
this.isUse = false;
this.$nextTick(() => (this.isUse = true))
},
//刷新组件
reload() {
this.isDiscount = false;
this.$nextTick(() => (this.isDiscount = true))
},
4 years ago
//查询优惠券详情
getUserNormalDiscountList() {
let params = {
couponId: this.couponId
}
4 years ago
getUserNormalDiscountList(params).then(res => {
if (res.return_code == '000000') {
this.UserNormalDiscountList = res.return_data;
}
})
4 years ago
},
//查询工会卡余额
getHuiLianTongCardBalance() {
let params = {
cardNo: this.user.hltCardNo.cardNo
}
getHuiLianTongCardBalance(params).then(res => {
if (res.return_code == '000000') {
this.tongCardPrice = res.return_data.balance;
}
});
},
// H5获取手机号
jumpH5Bding() {
uni.navigateTo({
url: '/pages/login/register'
})
},
// 微信获取手机号
loginByPhone(PhoneNumber) {
if (PhoneNumber.detail.iv == undefined) {
uni.showToast({
title: "用户取消授权",
icon: "none"
});
return;
}
let params = {
openId: app.globalData.openId,
iv: PhoneNumber.detail.iv,
encryptedData: PhoneNumber.detail.encryptedData
}
loginByPhone(params).then(res => {
if (res.return_code == '000000') {
app.globalData.userInfo = res.return_data
.object
.highUser;
this.user = res.return_data
.object
.highUser;
app.globalData.token = res.return_data.uniqueCode;
uni.setStorage({
key: "token",
data: res.return_data.uniqueCode
})
uni.setStorage({
key: "user",
data: res.return_data
.object
.highUser
})
let that = this;
that.toPay();
}
});
},
4 years ago
toPay() {
if (this.paytheprice == 0) {
if (!this.user.isSetPayPwd) {
uni.navigateTo({
url: '../login/updatePas/updatePas'
})
return;
}
if(!this.isAgree){
this.showPopupNeedKnow();
return;
}
this.$refs.paymentPassword.modalFun('show');
return;
}
if (this.paytype == '') {
uni.showToast({
title: '请选择支付方式',
icon: 'none',
duration: 2000
})
return;
}
1 year ago
/* 积分兑换*/
if(this.paytype == '8'){
let title="";
if(this.priceValue[1] >= this.availIntegal){ //积分划到最大了
title = "积分不足,是否充值"+Number(this.paytheprice)+"元的积分?";
}else{ //积分没有滑倒最大
let Remain = parseFloat((this.availIntegal - this.priceValue[1]).toFixed(2));/* 剩余积分数量 */
let price = parseFloat((this.paytheprice*100).toFixed(2)); /* 需要的积分数量*/
// console.log(Remain,price)
if(Remain >=price){
uni.showToast({
title: '积分充足,请拖动滑杆进行抵扣',
icon: 'none',
duration: 2000
})
return
}else{
title = "积分不足,是否充值"+Number(this.paytheprice) +"元的积分?"
}
}
let that = this;
uni.showModal({
title: '提示',
content: title,
success: function (res) {
if (res.confirm) {
uni.navigateTo({
url:'/pages/user/deposit/deposit?inputAmount='+that.paytheprice
})
} else if (res.cancel) {
}
}
});
return
}
if (this.orderDetails) {
this.wechatPay(this.orderDetails);
return;
}
4 years ago
uni.showLoading({
title: '提交订单中...'
})
if (this.couponList.reserveStatus) {
this.storeId = app.globalData.storeid
}
4 years ago
let goods = {
"childOrderList": [{
4 years ago
"goodsId": this.couponId,
"goodsPrice": this.paytheprice,
"goodsType": 1,
"saleCount": 1,
}],
"payGold": this.priceValue[1],
"promoteCode": this.identificationCode,
memDiscountId: this.memDiscountId,
"companyId": app.globalData.companyId,
"storeId": this.storeId,
"postData": {
"address": this.contactAddress,
"user": this.contactPepole,
"phone": this.contactPhone
}
4 years ago
}
create(goods).then(res => {
uni.hideLoading();
4 years ago
if (res.return_code == '000000') {
this.jumpType = res.return_data.highChildOrderList[0].ext1;
this.orderId = res.return_data.orderNo;
this.orderDetails = res.return_data;
this.wechatPay(res.return_data);
4 years ago
} else {
uni.showToast({
title: res.return_msg,
icon: 'none',
duration: 2000
});
}
})
},
//获取选择支付方式
changeRiado() {
if (!this.user.isSetHltCard) {
uni.showToast({
icon: 'none',
title: '当前账号还未绑定,前往绑定',
duration: 2000,
success() {
setTimeout(() => {
uni.navigateTo({
url: '../user/bindingCard/bindingCard'
})
}, 1000)
}
});
return;
}
},
//获取订单数据
wechatPay(item) {
let that = this;
if (that.paytype == '') {
uni.showToast({
title: '请选择支付方式',
icon: 'none',
duration: 2000
})
return;
}
if (that.paytype == '2') {
// #ifdef H5
let params = {
"orderNo": item.orderNo,
"openId": app.globalData.openId,
"openIdType": 2
}
// #endif
// #ifdef MP
let params = {
"orderNo": item.orderNo,
"openId": app.globalData.openId,
"openIdType": 1
}
// #endif
wechatPay(params).then(res => {
if (res.return_code == '000000') {
// #ifdef MP
uni.showLoading({
title: '支付中...'
})
uni.requestPayment({
"appId": res.return_data.appId,
"nonceStr": res.return_data.nonceStr,
"package": res.return_data.package,
"paySign": res.return_data.sign,
"signType": "MD5",
"timeStamp": res.return_data.timeStamp,
success: function(res) {
uni.hideLoading();
uni.showToast({
title: '支付成功'
})
app.globalData.storeid = '';
app.globalData.storename = '';
uni.reLaunch({
url: '../pay/success/success?id=' + that
.couponId
});
},
fail: function(err) {
uni.hideLoading();
uni.navigateBack({})
},
});
// #endif
//判断是否是公众号
// #ifdef H5
//判断微信浏览器
that.payRequest(res);
// #endif
} else {
uni.showToast({
title: res.return_msg,
icon: 'none'
})
}
})
}
if (that.paytype == '3') {
if (!that.user.isSetPayPwd) {
uni.navigateTo({
url: '../login/updatePas/updatePas'
})
return;
}
if (that.tongCardPrice < that.paytheprice) {
uni.showToast({
icon: 'none',
title: '工会卡余额不足',
duration: 2000,
});
return;
}
if (!that.user.isSetHltCard) {
uni.showToast({
icon: 'none',
title: '当前账号还未绑定,前往绑定',
duration: 2000,
success() {
setTimeout(() => {
uni.navigateTo({
url: '../user/bindingCard/bindingCard'
})
}, 1000)
}
});
return;
}
that.$refs.paymentPassword.modalFun('show');
}
if (that.paytype == '7') {
if (!that.user.isSetPayPwd) {
uni.navigateTo({
url: '../login/updatePas/updatePas'
})
return;
}
that.$refs.paymentPassword.modalFun('show');
}
if (that.paytype == '6') {
if (!that.user.isSetPayPwd) {
uni.navigateTo({
url: '../login/updatePas/updatePas'
})
return;
}
if (!that.user.isSetOilCard) {
uni.showToast({
icon: 'none',
title: '当前账号还未绑定,前往绑定',
duration: 2000,
success() {
setTimeout(() => {
uni.navigateTo({
url: '../user/bindingCard/bindingCard'
})
}, 1000)
}
});
return;
}
that.$refs.paymentPassword.modalFun('show');
}
},
submitHandle(e) {
this.PaymentPassword = e.value;
if (this.PaymentPassword == '') {
uni.showToast({
title: '请勿手动关闭弹窗',
icon: 'none',
duration: 2000
})
return;
}
uni.showLoading({
title: '支付中...'
})
if (this.paytheprice == 0) {
let goods = {
"childOrderList": [{
"goodsId": this.couponId,
"goodsPrice": this.paytheprice,
"goodsType": 1,
"saleCount": 1,
}],
"payGold": this.priceValue[1],
"promoteCode": this.identificationCode,
"payPwd": this.PaymentPassword,
"companyId": app.globalData.companyId,
memDiscountId: this.memDiscountId
}
create(goods).then(res => {
uni.hideLoading();
if (res.return_code == '000000') {
uni.showToast({
title: '支付成功'
})
app.globalData.storeid = '';
app.globalData.storename = '';
uni.reLaunch({
url: '../pay/success/success?id=' + this
.couponId
});
} else {
uni.showToast({
title: res.return_msg,
icon: 'none',
duration: 2000
});
}
})
return;
}
if (this.paytype == '3' || this.paytype == '6' || this.paytype == '7') {
let cardNo;
if (this.paytype == 3) {
cardNo = this.user.hltCardNo.cardNo;
}
if (this.paytype == 6) {
cardNo = this.user.oilCard.cardNo;
}
if (this.paytype == 7) {
cardNo = this.oilUserno;
}
let params = {
"orderNo": this.orderId,
"cardNo": cardNo,
"password": this.PaymentPassword
}
cardPay(params).then(res => {
uni.hideLoading();
if (res.return_code == '000000') {
uni.showToast({
title: '支付成功'
})
app.globalData.storeid = '';
app.globalData.storename = '';
uni.reLaunch({
url: '../pay/success/success?id=' + this.couponId
});
return;
}
if (res.return_code == '102130') {
uni.navigateTo({
url: '../../login/updatePas/updatePas'
})
return;
}
uni.showToast({
title: res.return_msg,
icon: 'none'
})
})
}
4 years ago
},
payRequest: function(self) {
uni.showLoading({
title: '支付中...'
})
jweixin.config({
// debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
appId: self.return_data.appId, // 必填,公众号的唯一标识
timestamp: self.return_data.timeStamp, // 必填,生成签名的时间戳
nonceStr: self.return_data.nonceStr, // 必填,生成签名的随机串
signature: self.return_data.sign, // 必填,签名,见附录1
jsApiList: ['chooseWXPay'] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
});
uni.hideLoading();
jweixin.ready(function() {
jweixin.checkJsApi({
jsApiList: ['chooseWXPay'], // 需要检测的JS接口列表,所有JS接口列表见附录2,
success: function(res) {},
fail: function(res) {}
});
jweixin.chooseWXPay({
appId: self.return_data.appId,
timestamp: self.return_data
.timeStamp, // 支付签名时间戳,注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
nonceStr: self.return_data.nonceStr, // 支付签名随机串,不长于 32 位
package: self.return_data
.package, // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=***)
signType: 'MD5', // 签名方式,默认为'SHA1',使用新版支付需传入'MD5'
paySign: self.return_data.sign, // 支付签名
success: function(res) {
// 支付成功后的回调函数
uni.showToast({
title: '支付成功'
})
app.globalData.storeid = '';
app.globalData.storename = '';
if (that.jumpType == 4) {
uni.reLaunch({
url: '/pages/tabBar/user/user'
});
} else {
uni.reLaunch({
url: '../success/success?id=' + that.couponId
});
}
},
cancel: function(r) {
uni.navigateBack({
})
},
fail: function(res) {
uni.navigateBack({
})
}
});
});
jweixin.error(function(res) {
uni.showToast({
icon: 'none',
title: '支付失败了',
duration: 4000
});
uni.navigateBack({
})
});
},
blockStart() {},
blockMoving() {
// console.log('正在滑动中')
},
//滑动结束
blockEnd() {
this.isDiscount = 1;
if (this.deductionPrice == 0) {
this.paytheprice = parseFloat(this.saveprice - parseFloat(this.priceValue[1] / 100).toFixed(2))
.toFixed(
2);
} else {
this.paytheprice = parseFloat(this.orderPrice - parseFloat(this.priceValue[1] / 100).toFixed(2) - this
.deductionPrice).toFixed(2);
}
1 year ago
if(Number(this.paytheprice)==0&&!this.payWeixin){
1 year ago
this.paytype = 8;
}
1 year ago
// if (this.paytheprice == 0) {
// // if(this.paytype!=8){
// this.isUse = false;
// this.paytype = '';
// // }
// } else {
// this.isUse = true;
// }
this.getRebateIntegral();
},
//跳转积分充值
jumpdeposits() {
uni.navigateTo({
url: '../user/deposit/deposit'
})
}
}
}
4 years ago
</script>
<style lang="scss">
page {
background-color: #f7f7f7;
}
.needKnowBtn{
height: 40px;
line-height: 40px;
border-radius: 20px;
}
.active{
color:#ffffff;
background: linear-gradient(to right, #089bf5, #0083f5) no-repeat;
}
.nactive{
background:#6666;
color:gray;
}
.comorder {
background-color: #FFFFFF;
border-radius: 8px;
}
.jtcs {
width: 40rpx;
height: 40rpx;
margin-top: 30rpx;
}
.cj-slider {
width: 100%;
align-items: center;
display: flex;
}
.goodsimg {
align-items: center;
display: flex;
image {
width: 170rpx;
max-height: 170rpx;
}
}
.yhprice {
width: 100%;
height: 25px;
text-align: right;
margin-top: -20px;
}
.price-number {
width: 100%;
display: flex;
justify-content: space-between;
align-items: flex-end;
font-size: 28upx;
height: 40upx;
.price {
color: #FE4545;
display: flex;
max-width: 50%;
align-items: center;
}
.number {
display: flex;
align-items: center;
width: 50%;
text-decoration: line-through;
}
}
.yhqky {
background: #ff0034;
color: #ffffff;
font-size: 14px;
padding-left: 5px;
padding-right: 5px;
margin-left: 8px;
padding-top: 2px;
padding-bottom: 2px;
}
4 years ago
.addr {
width: 86%;
padding: 20upx 3%;
margin: 30upx auto 20upx auto;
box-shadow: 0upx 5upx 20upx rgba(0, 0, 0, 0.1);
border-radius: 20upx;
display: flex;
4 years ago
.icon {
width: 80upx;
height: 80upx;
display: flex;
align-items: center;
image {
width: 60upx;
height: 60upx;
}
}
4 years ago
.tel-name {
width: 100%;
display: flex;
4 years ago
font-size: 32upx;
.tel {
margin-left: 40upx;
}
4 years ago
}
.addres {
width: 100%;
font-size: 26upx;
color: #999;
}
}
.tccs {
box-shadow: 0rpx 0rpx 10rpx rgba(0, 0, 0, 0.2);
border: 1px solid #f6f6f6;
border-radius: 8px;
align-items: center;
display: flex;
4 years ago
image {
width: 160rpx;
max-height: 160rpx;
}
}
4 years ago
.tcrig {
margin-left: 20rpx;
}
4 years ago
.info {
display: flex;
justify-content: space-between;
align-items: flex-end;
width: 92%;
}
4 years ago
.order {
width: 86%;
padding: 10upx 3%;
margin: 30upx auto 20upx auto;
box-shadow: 0upx 5upx 20upx rgba(0, 0, 0, 0.1);
border-radius: 20upx;
.row {
margin: 20upx 0;
height: 40upx;
display: flex;
.left {
font-size: 28upx;
}
.right {
margin-left: 40upx;
font-size: 26upx;
color: #999;
4 years ago
input {
font-size: 26upx;
color: #999;
}
}
}
}
4 years ago
.footer {
width: 92%;
padding: 0 4%;
background-color: #fbfbfb;
height: 100upx;
display: flex;
justify-content: flex-end;
align-items: center;
font-size: 28upx;
position: fixed;
bottom: 0upx;
z-index: 5;
4 years ago
.settlement {
width: 100%;
display: flex;
justify-content: flex-end;
align-items: center;
4 years ago
.sum {
width: 68%;
font-size: 18px;
margin-right: 10upx;
display: flex;
justify-content: flex-start;
4 years ago
.money {
color: #eb5823;
font-weight: 600;
}
}
4 years ago
.btn {
padding: 0 45rpx;
height: 80rpx;
background-color: #0083f5;
color: #fff;
display: flex;
justify-content: center;
align-items: center;
font-size: 30upx;
border-radius: 40upx;
}
}
}
4 years ago
.jfrecharge {
background-color: #0083f5;
padding: 5px 20rpx;
color: #fff;
margin-left: 50%;
justify-content: center;
align-items: center;
font-size: 30rpx;
border-radius: 40rpx;
}
4 years ago
.goods-list {
width: 100%;
padding: 0;
.tis {
width: 100%;
height: 60upx;
display: flex;
justify-content: center;
align-items: center;
font-size: 32upx;
}
.row {
width: calc(92%);
height: calc(22vw + 40upx);
margin: 20upx auto;
border-radius: 15upx;
box-shadow: 0upx 5upx 20upx rgba(0, 0, 0, 0.1);
display: flex;
align-items: center;
position: relative;
overflow: hidden;
z-index: 4;
border: 0;
.menu {
.icon {
color: #fff;
// font-size: 25upx;
}
position: absolute;
width: 30%;
height: 100%;
right: 0;
display: flex;
justify-content: center;
align-items: center;
background-color: red;
color: #fff;
z-index: 2;
}
.carrier {
.checkbox-box {
padding-left: 20upx;
flex-shrink: 0;
height: 22vw;
margin-right: 20upx;
}
position: absolute;
width: 94%;
margin-left: 3%;
padding: 0 0;
height: 100%;
z-index: 3;
display: flex;
align-items: center;
.goods-info {
width: 100%;
display: flex;
padding-right: 20upx;
.img {
width: 22vw;
height: 22vw;
border-radius: 10upx;
overflow: hidden;
flex-shrink: 0;
margin-right: 10upx;
image {
width: 22vw;
height: 22vw;
}
}
.info {
width: 100%;
height: 22vw;
overflow: hidden;
display: flex;
flex-wrap: wrap;
position: relative;
.title {
width: 100%;
font-size: 16px;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
// text-align: justify;
overflow: hidden;
}
.spec {
font-size: 14px;
color: #a7a7a7;
height: 30upx;
display: flex;
align-items: center;
padding: 0;
border-radius: 15upx;
margin-bottom: 20vw;
}
.price-number {
position: absolute;
width: 100%;
bottom: 0upx;
display: flex;
justify-content: space-between;
align-items: flex-end;
font-size: 28upx;
height: 60upx;
}
}
}
}
}
}
.username {
width: calc(100% - 100upx);
height: 100upx;
display: flex;
align-items: center;
border-bottom: 1px solid #f6f6f6;
padding: 8upx 20upx;
.namecont {
color: #666666;
width: 28%;
}
}
</style>