Commit 22681fd6 by honghong

倒计时,轮播图跳转

parent 61feeae6
......@@ -44,7 +44,7 @@
</view>
<view class="content-accomplish">
<view class="">
截止1小时内支付完成 <text>00:59:42</text>
截止1小时内支付完成 <text>{{detailInfo.isEndTime}}</text>
</view>
<button @click="jump(2)">立即支付 {{sumPrice}}</button>
</view>
......@@ -52,7 +52,9 @@
</template>
<script>
import {userDiscountList} from '@/api/system/index.js'
import {
userDiscountList
} from '@/api/system/index.js'
import apiBaseConfig from '@/config/index.js';
export default {
data() {
......@@ -62,9 +64,12 @@
scrollTopHeader: 0,
isUse: true,
detailInfo: {}, //详情数据
payInfo:{},
discountList:[]
payInfo: {},
discountList: [],
timer: "", //定时器
isEndTime: "", //倒计时要有个初始值
};
},
created() {
......@@ -74,48 +79,71 @@
let that = this
if (option.detailInfo) {
this.detailInfo = JSON.parse(decodeURIComponent(option.detailInfo))
console.log(this.detailInfo,'读书')
}
this.timer = setInterval(() => {
let allTime = 0;
let h = that.detailInfo.isEndTime.substring(0, 2);
let m = that.detailInfo.isEndTime.substring(3, 5);
let s = that.detailInfo.isEndTime.substring(6, 8);
allTime = Number(h) * 60 * 60 + Number(m) * 60 + Number(s);
if (allTime <= 0) return clearInterval(this.timer); //执行倒计时结束逻辑
allTime--;
h = parseInt(allTime / 3600) < 10 ? '0' + String(parseInt(allTime / 3600)) : parseInt(allTime /
3600);
m = parseInt(allTime / 60) < 10 ? '0' + String(parseInt(allTime / 60)) : parseInt(allTime / 60);
s = allTime % 60 < 10 ? '0' + String(allTime % 60) : allTime % 60;
that.detailInfo.isEndTime = h + "时" + m + "分" + s + "秒";
}, 1000)
uni.$on('payInfo', res => {
console.log(res,'打算今年');
that.payInfo = res
})
},
onUnload() {
uni.$off('payInfo')
},
computed:{
sumPrice(){
computed: {
sumPrice() {
let that = this
// 1.判断优惠券是否有值并且价格大于优惠券时
// console.log(that.payInfo.fullSubtraction,that.detailInfo.actualAmount,'第三句话')
if(that.payInfo.fullSubtraction && Number(that.detailInfo.actualAmount) > Number(that.payInfo.fullSubtraction)){
if (that.payInfo.fullSubtraction && Number(that.detailInfo.actualAmount) > Number(that.payInfo
.fullSubtraction)) {
// console.log('优质',that.detailInfo.actualAmount - that.payInfo.fullSubtraction)
// 判断是否使用折扣(使用×折扣)
return that.isUse ? Number((that.detailInfo.actualAmount - that.payInfo.fullSubtraction) * that.discountList[0].discountRatio).toFixed(2): Number(that.detailInfo.actualAmount - that.payInfo.fullSubtraction).toFixed(2)
}else{
if(that.discountList.length && that.discountList[0].discountRatio){
return that.detailInfo.actualAmount && that.isUse ? Number(that.detailInfo.actualAmount * that.discountList[0].discountRatio).toFixed(2) : that.detailInfo.actualAmount
}else{
return that.isUse ? Number((that.detailInfo.actualAmount - that.payInfo.fullSubtraction) * that
.discountList[0].discountRatio).toFixed(2) : Number(that.detailInfo.actualAmount - that.payInfo
.fullSubtraction).toFixed(2)
} else {
if (that.discountList.length && that.discountList[0].discountRatio) {
return that.detailInfo.actualAmount && that.isUse ? Number(that.detailInfo.actualAmount * that
.discountList[0].discountRatio).toFixed(2) : that.detailInfo.actualAmount
} else {
that.isUse = false
return that.detailInfo.actualAmount && that.isUse ? Number(that.detailInfo.actualAmount * that.discountList[0].discountRatio).toFixed(2) : that.detailInfo.actualAmount
return that.detailInfo.actualAmount && that.isUse ? Number(that.detailInfo.actualAmount * that
.discountList[0].discountRatio).toFixed(2) : that.detailInfo.actualAmount
}
}
}
},
methods: {
async getDisCountList(){
const data_back = await userDiscountList({useStatus:0})
const {code,rows,total} = data_back
if(code === 200 && total > 0){
async getDisCountList() {
const data_back = await userDiscountList({
useStatus: 0
})
const {
code,
rows,
total
} = data_back
if (code === 200 && total > 0) {
this.discountList = rows
this.isUse = true
}else{
} else {
this.isUse = false
}
},
jump(val) {
let that = this
if (val == 1) {
......@@ -124,9 +152,9 @@
});
} else {
let orderQuery = {
orderId:that.detailInfo.id,//订单的id
couponId:that.payInfo.id ? that.payInfo.id : '',//优惠券的id
discountId:that.isUse && that.discountList.length ? that.discountList[0].id : '',//折扣的id
orderId: that.detailInfo.id, //订单的id
couponId: that.payInfo.id ? that.payInfo.id : '', //优惠券的id
discountId: that.isUse && that.discountList.length ? that.discountList[0].id : '', //折扣的id
}
this.$uniGo.navigateTo({
url: `/demand/confirm/index?orderQuery=${encodeURIComponent(JSON.stringify(orderQuery))}&sumPrice=${that.sumPrice}&title=${this.detailInfo.title}`
......
......@@ -2,12 +2,12 @@
<view class="index">
<com-navbar :title="title" :titleStyle="{ color: '#000000', fontSize: '32rpx' }" />
<view class="index-content" v-if="useCouponList.length || couponLoseList.length">
<view class="index-content-item" v-for="(item,index) in useCouponList">
<view class="index-content-item" >
<view class="index-content-item-nav baiyin-flex baiyin-flex-c-b">
<text></text>
<view>可用优惠券{{cantotal}}</view>
</view>
<view class="index-content-item-qu" @click="optionData.type === 'pay'?jump(item):null">
<view class="index-content-item-qu" v-for="(item,index) in useCouponList" @click="optionData.type === 'pay'?jump(item):null">
<image class="index-content-item-qu-bg" src="@/static/icon/xy01.png" mode=""></image>
<view class="index-content-item-qu-bl">
<text class="index-content-item-qu-bl-tl">满减优惠券</text>
......
......@@ -67,7 +67,7 @@
var eData = options.target.dataset;
console.log(eData.name); // shareBtn
// 此处可以修改 shareObj 中的内容
shareObj.path = '/my/login/login?id=${that.$store.state.login.userInfo.user.id}';
shareObj.path = `/my/login/login?id=${that.$store.state.login.userInfo.user.id}`;
}
console.log("shareObj",shareObj)
// 返回shareObj
......
......@@ -24,7 +24,7 @@
xcxCode:''
},
token:'',
InviterId:'',//邀请人的id
inviterId:'',//邀请人的id
}
},
onLoad(option) {
......@@ -38,7 +38,7 @@
})
this.getUserInfo()
if(option.id){
this.InviterId = option.id
this.inviterId = option.id
}
},
methods: {
......@@ -56,9 +56,9 @@
async getSessionkeyAndOpenId(xcxCode) {
let that = this
let codeParams = {}
if(that.InviterId){
if(that.inviterId){
that.$set(codeParams,'xcxCode',xcxCode)
that.$set(codeParams,'InviterId',that.InviterId)
that.$set(codeParams,'inviterId',that.inviterId)
}else{
that.$set(codeParams,'xcxCode',xcxCode)
}
......
......@@ -49,8 +49,8 @@
<view class="buttoncolor" v-if="subscript == '3'">
<button v-if="item.status == 3" style="background: red;" class="buttoncl"
@click.stop="abolish(2,item)">退款</button>
<button v-else-if="item.status == 5 || item.status == 6" class="buttonclde buttonGray"
@click.stop="abolish(4,item)">{{item.status == 5 ? '退款中' : '已退款'}}</button>
<button v-else-if="item.status == 4 || item.status == 5 || item.status == 6" class="buttonclde buttonGray"
@click.stop="abolish(4,item)">{{item.status == 4 ? '已完成' : item.status == 5 ? '退款中' : item.status == 6 ? '已退款' : ''}}</button>
<button class="buttoncl" @click.stop="abolish(3,item)">详情</button>
</view>
</view>
......
......@@ -111,7 +111,7 @@
that.statusNeedList = []
if (that.subscript == 3) {
that.$delete(that.needInfo, "status")
that.$set(that.needInfo, 'statusList', '3,5,6')
that.$set(that.needInfo, 'statusList', '3,4,5,6')
} else {
that.$delete(that.needInfo, "statusList")
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment