parent
2f4239aba2
commit
d219029607
@ -0,0 +1,31 @@ |
|||||||
|
<!DOCTYPE html> |
||||||
|
<html lang="zh-CN"> |
||||||
|
<head> |
||||||
|
<meta charset="utf-8"> |
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge"> |
||||||
|
<meta name="viewport" |
||||||
|
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> |
||||||
|
<title> |
||||||
|
<%= htmlWebpackPlugin.options.title %> |
||||||
|
</title> |
||||||
|
<script> |
||||||
|
document.addEventListener('DOMContentLoaded', function() { |
||||||
|
document.documentElement.style.fontSize = document.documentElement.clientWidth / 20 + 'px' |
||||||
|
}) |
||||||
|
</script> |
||||||
|
<link rel="stylesheet" href="<%= htmlWebpackPlugin.options.baseUrl %>static/index.css" /> |
||||||
|
<link href="https://unpkg.com/video.js/dist/video-js.min.css" rel="stylesheet"> |
||||||
|
<script src="https://unpkg.com/video.js/dist/video.min.js"></script> |
||||||
|
<script src="https://cdn.bootcss.com/socket.io/2.1.1/socket.io.js"></script> |
||||||
|
<script src="https://open.95516.com/s/open/js/upsdk.js"></script> |
||||||
|
<script src="https://3gimg.qq.com/lightmap/components/geolocation/geolocation.min.js"></script> |
||||||
|
|
||||||
|
</head> |
||||||
|
<body> |
||||||
|
<noscript> |
||||||
|
<strong>Please enable JavaScript to continue.</strong> |
||||||
|
</noscript> |
||||||
|
<div id="app"></div> |
||||||
|
<!-- built files will be auto injected --> |
||||||
|
</body> |
||||||
|
</html> |
@ -0,0 +1,564 @@ |
|||||||
|
<template> |
||||||
|
<view> |
||||||
|
<view class="block"> |
||||||
|
<view class="content"> |
||||||
|
<view class="orderinfo"> |
||||||
|
<view class="row"> |
||||||
|
<view class="nominal">订单金额:</view> |
||||||
|
<view class="text">{{amount}} 元</view> |
||||||
|
</view> |
||||||
|
</view> |
||||||
|
</view> |
||||||
|
</view> |
||||||
|
<view class="block"> |
||||||
|
<view class="title"> |
||||||
|
选择支付方式 |
||||||
|
</view> |
||||||
|
<view class="content"> |
||||||
|
<view class="pay-list" v-for="(item,index) in paytypeList" :key="index"> |
||||||
|
<view class="row" @tap="paytype='3'" v-if="item == 3"> |
||||||
|
<view class="left"> |
||||||
|
<image :src="imagewxUrl+imgadres2"></image> |
||||||
|
</view> |
||||||
|
<view class="center"> |
||||||
|
汇联通工会卡(余额:{{tongCardPrice}}元) |
||||||
|
</view> |
||||||
|
<view class="right"> |
||||||
|
<radio :checked="paytype=='3'" @click="changeRiado()" color="#0083f5" /> |
||||||
|
</view> |
||||||
|
</view> |
||||||
|
<!-- <view class="row" @tap="paytype='oilcard'"> |
||||||
|
<view class="left"> |
||||||
|
<image :src="imagewxUrl+imgadres1"></image> |
||||||
|
</view> |
||||||
|
<view class="center"> |
||||||
|
油卡支付(余额:{{oilPirce}}元) |
||||||
|
</view> |
||||||
|
<view class="right"> |
||||||
|
<radio :checked="paytype=='oilcard'" @click="changeRiado1()" color="#0083f5" /> |
||||||
|
</view> |
||||||
|
</view> --> |
||||||
|
<view class="row" @tap="paytype='2'" v-if="item == 2"> |
||||||
|
<view class="left"> |
||||||
|
<image :src="imagewxUrl+imgadres"></image> |
||||||
|
</view> |
||||||
|
<view class="center"> |
||||||
|
微信支付 |
||||||
|
</view> |
||||||
|
<view class="right"> |
||||||
|
<radio :checked="paytype=='2'" color="#0083f5" /> |
||||||
|
</view> |
||||||
|
</view> |
||||||
|
</view> |
||||||
|
</view> |
||||||
|
</view> |
||||||
|
<view class="pay"> |
||||||
|
<view class="btn" @tap="orderToPay">立即支付</view> |
||||||
|
<view class="tis"> |
||||||
|
点击立即支付,即代表您同意<view class="terms"> |
||||||
|
《条款协议》 |
||||||
|
</view> |
||||||
|
</view> |
||||||
|
</view> |
||||||
|
|
||||||
|
<ssPaymentPassword ref="paymentPassword" :mode="1" @submit="submitHandle" /> |
||||||
|
</view> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script> |
||||||
|
import { |
||||||
|
getHuiLianTongCardBalance, |
||||||
|
oilCardPay, |
||||||
|
findUser, |
||||||
|
qianzhuorderToPayByWx, |
||||||
|
czhltUnionCardPay, |
||||||
|
getThirdPartyByDetail |
||||||
|
} from '../../Utils/Api.js' |
||||||
|
import ssPaymentPassword from '@/components/sanshui-payment-password/index.vue'; |
||||||
|
let app = getApp(); |
||||||
|
// #ifdef H5 |
||||||
|
var jweixin = require('jweixin-module'); |
||||||
|
// #endif |
||||||
|
export default { |
||||||
|
components: { |
||||||
|
ssPaymentPassword |
||||||
|
}, |
||||||
|
data() { |
||||||
|
return { |
||||||
|
amount: 0, |
||||||
|
imagewxUrl: app.globalData.imageWxImg, |
||||||
|
imgadres: 'wxpay.png', |
||||||
|
imgadres1: 'oilcard.png', |
||||||
|
imgadres2: 'ghkpay.png', |
||||||
|
paytype: '', //支付类型 |
||||||
|
orderNo: '', |
||||||
|
user: '', //用户信息 |
||||||
|
PaymentPassword: '', //支付密码 |
||||||
|
tongCardPrice: 0, //工会卡余额 |
||||||
|
oilPirce: 0, //油卡金额 |
||||||
|
showType: '', //支付方式 |
||||||
|
paytypeList: [], //支付选择 |
||||||
|
productType: '' //分类 星巴克 ,肯德基 |
||||||
|
}; |
||||||
|
}, |
||||||
|
onLoad(e) { |
||||||
|
this.orderNo = e.orderId; |
||||||
|
this.productType = e.productType; |
||||||
|
this.amount = e.amount; |
||||||
|
if (!app.globalData.userInfo) { |
||||||
|
this.findUser() |
||||||
|
} |
||||||
|
}, |
||||||
|
onShow() { |
||||||
|
this.user = app.globalData.userInfo; |
||||||
|
this.getThirdPartyByDetail(); |
||||||
|
if (app.globalData.userInfo) { |
||||||
|
this.findUser(); |
||||||
|
} |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
//查询支付方式 |
||||||
|
getThirdPartyByDetail() { |
||||||
|
// #ifdef H5 |
||||||
|
this.showType = 2; |
||||||
|
// #endif |
||||||
|
// #ifdef MP |
||||||
|
this.showType = 1; |
||||||
|
// #endif |
||||||
|
let datas = { |
||||||
|
platformId: this.showType, |
||||||
|
regionId: app.globalData.cityId, |
||||||
|
productType: this.productType |
||||||
|
} |
||||||
|
getThirdPartyByDetail(datas).then(res => { |
||||||
|
if (res.return_code == '000000') { |
||||||
|
this.paytypeList = res.return_data.productPayType.split(','); |
||||||
|
this.paytypeList = this.paytypeList.slice(0, this.paytypeList.length - 1); |
||||||
|
} |
||||||
|
}); |
||||||
|
}, |
||||||
|
//查询我的信息 |
||||||
|
findUser() { |
||||||
|
let params; |
||||||
|
findUser(params).then(res => { |
||||||
|
if (res.return_code == '000000') { |
||||||
|
app.globalData.userInfo = res.return_data; |
||||||
|
this.user = res.return_data; |
||||||
|
if (res.return_data.hltCardNo) { |
||||||
|
this.getHuiLianTongCardBalance(); |
||||||
|
} |
||||||
|
if (res.return_data.oilCard) { |
||||||
|
this.oilPirce = res.return_data.oilCard.amount; |
||||||
|
} |
||||||
|
uni.setStorage({ |
||||||
|
key: "user", |
||||||
|
data: res.return_data |
||||||
|
}) |
||||||
|
} |
||||||
|
}); |
||||||
|
}, |
||||||
|
//获取选择支付方式 |
||||||
|
changeRiado() { |
||||||
|
if (!this.user.isSetHltCard) { |
||||||
|
uni.showToast({ |
||||||
|
icon: 'none', |
||||||
|
title: '当前账号还未绑定,前往绑定', |
||||||
|
duration: 2000, |
||||||
|
success() { |
||||||
|
setTimeout(() => { |
||||||
|
uni.navigateTo({ |
||||||
|
url: '/pages/user/bindingCard/bindingCard' |
||||||
|
}) |
||||||
|
}, 1000) |
||||||
|
} |
||||||
|
}); |
||||||
|
return; |
||||||
|
} |
||||||
|
}, |
||||||
|
//油卡支付 |
||||||
|
changeRiado1() { |
||||||
|
if (!this.user.isSetOilCard) { |
||||||
|
uni.showToast({ |
||||||
|
icon: 'none', |
||||||
|
title: '当前账号还未绑定,前往绑定', |
||||||
|
duration: 2000, |
||||||
|
success() { |
||||||
|
setTimeout(() => { |
||||||
|
uni.navigateTo({ |
||||||
|
url: '/pages/user/bindingCard/bindingCard' |
||||||
|
}) |
||||||
|
}, 1000) |
||||||
|
} |
||||||
|
}); |
||||||
|
return; |
||||||
|
} |
||||||
|
}, |
||||||
|
//查询工会卡余额 |
||||||
|
//查询详情 |
||||||
|
getHuiLianTongCardBalance() { |
||||||
|
let params = { |
||||||
|
cardNo: this.user.hltCardNo.cardNo |
||||||
|
} |
||||||
|
getHuiLianTongCardBalance(params).then(res => { |
||||||
|
if (res.return_code == '000000') { |
||||||
|
this.tongCardPrice = res.return_data.balance; |
||||||
|
} |
||||||
|
|
||||||
|
}); |
||||||
|
}, |
||||||
|
//获取订单数据 |
||||||
|
orderToPay() { |
||||||
|
let that = this; |
||||||
|
if (that.paytype == '2') { |
||||||
|
// #ifdef H5 |
||||||
|
let params = { |
||||||
|
"orderId": that.orderNo, |
||||||
|
"openId": app.globalData.openId, |
||||||
|
"orderScene": "GOODS_ORDER", |
||||||
|
"openIdType": 2 |
||||||
|
} |
||||||
|
// #endif |
||||||
|
// #ifdef MP |
||||||
|
let params = { |
||||||
|
"orderId": that.orderNo, |
||||||
|
"openId": app.globalData.openId, |
||||||
|
"orderScene": "GOODS_ORDER" |
||||||
|
} |
||||||
|
// #endif |
||||||
|
qianzhuorderToPayByWx(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: '支付成功' |
||||||
|
}) |
||||||
|
uni.reLaunch({ |
||||||
|
url: '/qianzhu-KFC/order-details/order-details?id=' + that.orderNo |
||||||
|
}) |
||||||
|
}, |
||||||
|
fail: function(err) { |
||||||
|
uni.hideLoading(); |
||||||
|
}, |
||||||
|
}); |
||||||
|
// #endif |
||||||
|
|
||||||
|
//判断是否是公众号 |
||||||
|
// #ifdef H5 |
||||||
|
//判断微信浏览器 |
||||||
|
that.payRequest(res); |
||||||
|
// #endif |
||||||
|
|
||||||
|
} else { |
||||||
|
uni.showToast({ |
||||||
|
title: res.return_msg, |
||||||
|
icon: 'none' |
||||||
|
}) |
||||||
|
} |
||||||
|
}) |
||||||
|
} else if (that.paytype == '3') { |
||||||
|
if (that.tongCardPrice < that.amount) { |
||||||
|
uni.showToast({ |
||||||
|
icon: 'none', |
||||||
|
title: '工会卡余额不足', |
||||||
|
duration: 2000, |
||||||
|
}); |
||||||
|
return; |
||||||
|
} |
||||||
|
if (!that.user.isSetPayPwd) { |
||||||
|
uni.navigateTo({ |
||||||
|
url: '/pages/login/updatePas/updatePas' |
||||||
|
}) |
||||||
|
return; |
||||||
|
} |
||||||
|
if (!that.user.isSetHltCard) { |
||||||
|
uni.showToast({ |
||||||
|
icon: 'none', |
||||||
|
title: '当前账号还未绑定,前往绑定', |
||||||
|
duration: 2000, |
||||||
|
success() { |
||||||
|
setTimeout(() => { |
||||||
|
uni.navigateTo({ |
||||||
|
url: '/pages/user/bindingCard/bindingCard' |
||||||
|
}) |
||||||
|
}, 1000) |
||||||
|
} |
||||||
|
}); |
||||||
|
return; |
||||||
|
} |
||||||
|
that.$refs.paymentPassword.modalFun('show'); |
||||||
|
} else if (that.paytype == 'oilcard') { |
||||||
|
if (!that.user.isSetPayPwd) { |
||||||
|
uni.navigateTo({ |
||||||
|
url: '/pages/login/updatePas/updatePas' |
||||||
|
}) |
||||||
|
return; |
||||||
|
} |
||||||
|
if (!that.user.isSetOilCard) { |
||||||
|
uni.showToast({ |
||||||
|
icon: 'none', |
||||||
|
title: '当前账号还未绑定,前往绑定', |
||||||
|
duration: 2000, |
||||||
|
success() { |
||||||
|
setTimeout(() => { |
||||||
|
uni.navigateTo({ |
||||||
|
url: '/pages/user/bindingCard/bindingCard' |
||||||
|
}) |
||||||
|
}, 1000) |
||||||
|
} |
||||||
|
}); |
||||||
|
return; |
||||||
|
} |
||||||
|
that.$refs.paymentPassword.modalFun('show'); |
||||||
|
} else { |
||||||
|
uni.showToast({ |
||||||
|
title: '请选择支付方式', |
||||||
|
icon: 'none', |
||||||
|
duration: 2000 |
||||||
|
}) |
||||||
|
} |
||||||
|
}, |
||||||
|
submitHandle(e) { |
||||||
|
this.PaymentPassword = e.value; |
||||||
|
uni.showLoading({ |
||||||
|
title: '支付中...' |
||||||
|
}) |
||||||
|
if (this.paytype == '3') { |
||||||
|
let params = { |
||||||
|
"orderId": this.orderNo, |
||||||
|
"cardNo": this.user.hltCardNo.cardNo, |
||||||
|
"password": this.PaymentPassword |
||||||
|
} |
||||||
|
czhltUnionCardPay(params).then(res => { |
||||||
|
uni.hideLoading(); |
||||||
|
if (res.return_code == '000000') { |
||||||
|
uni.showToast({ |
||||||
|
title: '支付成功' |
||||||
|
}) |
||||||
|
uni.reLaunch({ |
||||||
|
url: '/qianzhu-KFC/order-details/order-details?id=' + this.orderNo |
||||||
|
}) |
||||||
|
return; |
||||||
|
} |
||||||
|
if (res.return_code == '102130') { |
||||||
|
uni.navigateTo({ |
||||||
|
url: '/pages/login/updatePas/updatePas' |
||||||
|
}) |
||||||
|
return; |
||||||
|
} |
||||||
|
uni.showToast({ |
||||||
|
title: res.return_msg, |
||||||
|
icon: 'none' |
||||||
|
}) |
||||||
|
}) |
||||||
|
return; |
||||||
|
} |
||||||
|
if (this.paytype == 'oilcard') { |
||||||
|
let params = { |
||||||
|
"orderId": this.orderNo, |
||||||
|
"cardNo": this.user.oilCard.cardNo, |
||||||
|
"password": this.PaymentPassword |
||||||
|
} |
||||||
|
oilCardPay(params).then(res => { |
||||||
|
uni.hideLoading(); |
||||||
|
if (res.return_code == '000000') { |
||||||
|
uni.showToast({ |
||||||
|
title: '支付成功' |
||||||
|
}) |
||||||
|
uni.reLaunch({ |
||||||
|
url: '/qianzhu-KFC/order-details/order-details?id=' + this.orderNo |
||||||
|
}) |
||||||
|
return; |
||||||
|
} |
||||||
|
if (res.return_code == '102130') { |
||||||
|
uni.navigateTo({ |
||||||
|
url: '/pages/login/updatePas/updatePas' |
||||||
|
}) |
||||||
|
return; |
||||||
|
} |
||||||
|
uni.showToast({ |
||||||
|
title: res.return_msg, |
||||||
|
icon: 'none' |
||||||
|
}) |
||||||
|
}) |
||||||
|
return; |
||||||
|
} |
||||||
|
}, |
||||||
|
payRequest: function(self) { |
||||||
|
uni.showLoading({ |
||||||
|
title: '支付中...' |
||||||
|
}) |
||||||
|
jweixin.config({ |
||||||
|
// debug: true, // 开启调试模式,调用的所有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: '支付成功' |
||||||
|
}) |
||||||
|
uni.reLaunch({ |
||||||
|
url: '/qianzhu-KFC/order-details/order-details?id=' + this |
||||||
|
.orderNo |
||||||
|
}) |
||||||
|
}, |
||||||
|
cancel: function(r) {}, |
||||||
|
fail: function(res) {} |
||||||
|
}); |
||||||
|
}); |
||||||
|
|
||||||
|
jweixin.error(function(res) { |
||||||
|
uni.showToast({ |
||||||
|
icon: 'none', |
||||||
|
title: '支付失败了', |
||||||
|
duration: 4000 |
||||||
|
}); |
||||||
|
// config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。 |
||||||
|
/*alert("config信息验证失败");*/ |
||||||
|
}); |
||||||
|
}, |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
</script> |
||||||
|
|
||||||
|
<style lang="scss"> |
||||||
|
.block { |
||||||
|
width: 94%; |
||||||
|
padding: 0 3% 40upx 3%; |
||||||
|
|
||||||
|
.title { |
||||||
|
width: 100%; |
||||||
|
font-size: 34upx; |
||||||
|
} |
||||||
|
|
||||||
|
.content { |
||||||
|
.orderinfo { |
||||||
|
width: 100%; |
||||||
|
border-bottom: solid 1upx #eee; |
||||||
|
|
||||||
|
.row { |
||||||
|
width: 100%; |
||||||
|
height: 90upx; |
||||||
|
display: flex; |
||||||
|
align-items: center; |
||||||
|
|
||||||
|
.nominal { |
||||||
|
flex-shrink: 0; |
||||||
|
font-size: 32upx; |
||||||
|
color: #7d7d7d; |
||||||
|
} |
||||||
|
|
||||||
|
.text { |
||||||
|
width: 70%; |
||||||
|
margin-left: 10upx; |
||||||
|
overflow: hidden; |
||||||
|
text-overflow: ellipsis; |
||||||
|
white-space: nowrap; |
||||||
|
font-size: 32upx; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
.pay-list { |
||||||
|
width: 100%; |
||||||
|
border-bottom: solid 1upx #eee; |
||||||
|
|
||||||
|
.row { |
||||||
|
width: 100%; |
||||||
|
height: 120upx; |
||||||
|
display: flex; |
||||||
|
align-items: center; |
||||||
|
|
||||||
|
.left { |
||||||
|
width: 100upx; |
||||||
|
flex-shrink: 0; |
||||||
|
display: flex; |
||||||
|
align-items: center; |
||||||
|
|
||||||
|
image { |
||||||
|
width: 80upx; |
||||||
|
height: 80upx; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
.center { |
||||||
|
width: 100%; |
||||||
|
font-size: 30upx; |
||||||
|
} |
||||||
|
|
||||||
|
.right { |
||||||
|
width: 100upx; |
||||||
|
flex-shrink: 0; |
||||||
|
display: flex; |
||||||
|
justify-content: flex-end; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
.pay { |
||||||
|
margin-top: 20upx; |
||||||
|
width: 100%; |
||||||
|
display: flex; |
||||||
|
justify-content: center; |
||||||
|
flex-wrap: wrap; |
||||||
|
|
||||||
|
.btn { |
||||||
|
width: 70%; |
||||||
|
height: 80upx; |
||||||
|
border-radius: 80upx; |
||||||
|
display: flex; |
||||||
|
justify-content: center; |
||||||
|
align-items: center; |
||||||
|
color: #fff; |
||||||
|
background-color: #0083f5; |
||||||
|
box-shadow: 0upx 5upx 10upx rgba(0, 0, 0, 0.2); |
||||||
|
} |
||||||
|
|
||||||
|
.tis { |
||||||
|
margin-top: 10upx; |
||||||
|
width: 100%; |
||||||
|
font-size: 24upx; |
||||||
|
display: flex; |
||||||
|
justify-content: center; |
||||||
|
align-items: baseline; |
||||||
|
color: #999; |
||||||
|
|
||||||
|
.terms { |
||||||
|
color: #5a9ef7; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
</style> |
After Width: | Height: | Size: 53 KiB |
After Width: | Height: | Size: 7.2 KiB |
@ -0,0 +1,228 @@ |
|||||||
|
<template> |
||||||
|
<view> |
||||||
|
<view class="width90"> |
||||||
|
<view class="flright fotct"> |
||||||
|
<image class="coupon-img" :src="imageUrl+couponsDetails.highDiscount.discountImg"></image> |
||||||
|
</view> |
||||||
|
<view class="coupon-mes mart10" style="margin-right: 90px;"> |
||||||
|
<view class="fcor333 fontwig6 font24 width100 text2">{{couponsDetails.highDiscount.discountName}}</view> |
||||||
|
<view class="fcor666 font13 width100 mart5"> |
||||||
|
活动截止时间:{{salesEndTime | formatDate('-')}}</view> |
||||||
|
</view> |
||||||
|
<view class="fcor666 font13 width100 mart5"> |
||||||
|
领取有效期:{{couponsDetails.highDiscount.effectiveDay}}天 |
||||||
|
</view> |
||||||
|
<view class="fcor666 font13 width100 mart5"> |
||||||
|
剩余数量:{{couponsDetails.stockCount}} |
||||||
|
</view> |
||||||
|
</view> |
||||||
|
<view class="line1 mart15"></view> |
||||||
|
<button class="coupne-btn width60w mart20 marb20" @click="receiveDiscount">点击领取</button> |
||||||
|
<view class="width90 mart10 fcor666">去使用</view> |
||||||
|
<view v-if="minecoupones == '' " class="mart60 fotct font14 fcor666"> |
||||||
|
<image mode="widthFix" style="width: 70vw;" :src="imagewxUrl+imgadres"></image> |
||||||
|
</view> |
||||||
|
<view class="product-list mart20 width90"> |
||||||
|
<view class="product" v-for="product in minecoupones" :key="product.id" |
||||||
|
@tap="toGoods(product.highCoupon.id)"> |
||||||
|
<image mode="widthFix" :src="imageUrl+product.highCoupon.couponImg"></image> |
||||||
|
<view class="name">{{ product.highCoupon.couponName }}</view> |
||||||
|
<view class="info"> |
||||||
|
<view class="price"> |
||||||
|
¥{{ product.highCoupon.discountPrice}} |
||||||
|
</view> |
||||||
|
<view class="slogan" v-if="product.highCoupon.discountPrice !== product.highCoupon.salesPrice"> |
||||||
|
¥{{ product.highCoupon.salesPrice}} |
||||||
|
</view> |
||||||
|
</view> |
||||||
|
</view> |
||||||
|
</view> |
||||||
|
<view class="width100 height60"></view> |
||||||
|
|
||||||
|
</view> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script> |
||||||
|
import { |
||||||
|
getCouponByDiscount, |
||||||
|
getDiscountByCode, |
||||||
|
receive, |
||||||
|
} from '../../Utils/Api.js'; |
||||||
|
let app = getApp(); |
||||||
|
export default { |
||||||
|
data() { |
||||||
|
return { |
||||||
|
minecoupones: [], |
||||||
|
imageUrl: app.globalData.imgUrl, |
||||||
|
imagewxUrl: app.globalData.imageWxImg, |
||||||
|
imgadres: 'noorder.png', |
||||||
|
pageNum: 1, |
||||||
|
pageSize: 10, |
||||||
|
isNoMoreData: false, |
||||||
|
couponsDetails: '', |
||||||
|
salesEndTime: '', |
||||||
|
codes: '', |
||||||
|
} |
||||||
|
}, |
||||||
|
filters: { |
||||||
|
//过滤器 用于格式化时间 |
||||||
|
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; |
||||||
|
return `${year}${spe}${month}${spe}${day}`; |
||||||
|
} |
||||||
|
}, |
||||||
|
onShow() { |
||||||
|
}, |
||||||
|
onLoad() { |
||||||
|
this.getDiscountByCode(); |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
//获取卡券详情 |
||||||
|
getDiscountByCode() { |
||||||
|
let that = this; |
||||||
|
let params = { |
||||||
|
code: app.globalData.staffCode |
||||||
|
} |
||||||
|
getDiscountByCode(params).then(res => { |
||||||
|
if (res.return_code == '000000') { |
||||||
|
that.couponsDetails = res.return_data; |
||||||
|
that.salesEndTime = res.return_data.highDiscount.salesEndTime; |
||||||
|
that.getCouponByDiscount(res.return_data.highDiscount.id); |
||||||
|
} else { |
||||||
|
uni.showToast({ |
||||||
|
title: res.return_msg, |
||||||
|
icon: 'none', |
||||||
|
duration: 2000 |
||||||
|
}) |
||||||
|
} |
||||||
|
}) |
||||||
|
|
||||||
|
|
||||||
|
}, |
||||||
|
//根据优惠券查询卡券列表 |
||||||
|
getCouponByDiscount(item) { |
||||||
|
let params = { |
||||||
|
discountId: item |
||||||
|
} |
||||||
|
getCouponByDiscount(params).then(res => { |
||||||
|
if (res.return_code == '000000') { |
||||||
|
this.minecoupones = res.return_data; |
||||||
|
} |
||||||
|
}) |
||||||
|
}, |
||||||
|
//领取 |
||||||
|
receiveDiscount() { |
||||||
|
uni.showLoading({ |
||||||
|
title: '领取中...' |
||||||
|
}) |
||||||
|
let params = { |
||||||
|
code: app.globalData.staffCode |
||||||
|
} |
||||||
|
receive(params).then(res => { |
||||||
|
if (res.return_code == '000000') { |
||||||
|
uni.hideLoading(); |
||||||
|
uni.showToast({ |
||||||
|
icon: 'none', |
||||||
|
title: res.return_data, |
||||||
|
duration: 2000 |
||||||
|
}) |
||||||
|
this.getDiscountByCode(); |
||||||
|
} else { |
||||||
|
uni.hideLoading(); |
||||||
|
uni.showToast({ |
||||||
|
icon: 'none', |
||||||
|
title: res.return_msg, |
||||||
|
duration: 2000 |
||||||
|
}) |
||||||
|
} |
||||||
|
}) |
||||||
|
|
||||||
|
}, |
||||||
|
//商品跳转 |
||||||
|
toGoods(e) { |
||||||
|
uni.navigateTo({ |
||||||
|
url: '../../pages/order/confirmation?id=' + e |
||||||
|
}) |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
</script> |
||||||
|
|
||||||
|
<style lang="scss"> |
||||||
|
.coupon-mes { |
||||||
|
// margin-right: 90px; |
||||||
|
} |
||||||
|
|
||||||
|
.coupon-img { |
||||||
|
width: 80px; |
||||||
|
height: 80px; |
||||||
|
} |
||||||
|
|
||||||
|
.product-list { |
||||||
|
display: flex; |
||||||
|
justify-content: space-between; |
||||||
|
flex-wrap: wrap; |
||||||
|
|
||||||
|
.product { |
||||||
|
width: 48%; |
||||||
|
border-radius: 20upx; |
||||||
|
background-color: #fff; |
||||||
|
margin: 0 0 15upx 0; |
||||||
|
box-shadow: 0upx 5upx 25upx rgba(0, 0, 0, 0.1); |
||||||
|
|
||||||
|
image { |
||||||
|
width: 100%; |
||||||
|
border-radius: 20upx 20upx 0 0; |
||||||
|
} |
||||||
|
|
||||||
|
.name { |
||||||
|
width: 92%; |
||||||
|
padding: 7upx 4%; |
||||||
|
display: -webkit-box; |
||||||
|
-webkit-box-orient: vertical; |
||||||
|
-webkit-line-clamp: 1; |
||||||
|
text-align: justify; |
||||||
|
overflow: hidden; |
||||||
|
font-size: 30upx; |
||||||
|
} |
||||||
|
|
||||||
|
.info { |
||||||
|
display: flex; |
||||||
|
justify-content: space-between; |
||||||
|
align-items: flex-end; |
||||||
|
width: 92%; |
||||||
|
padding: 10upx 4% 10upx 4%; |
||||||
|
|
||||||
|
.price { |
||||||
|
color: #e65339; |
||||||
|
font-size: 30upx; |
||||||
|
font-weight: 600; |
||||||
|
} |
||||||
|
|
||||||
|
.slogan { |
||||||
|
color: #807c87; |
||||||
|
font-size: 24upx; |
||||||
|
text-decoration: line-through; |
||||||
|
margin-right: 10px; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
.coupne-btn { |
||||||
|
background-color: red; |
||||||
|
color: #FFFFFF; |
||||||
|
} |
||||||
|
</style> |
Loading…
Reference in new issue