Commit 22681fd6 by honghong

倒计时,轮播图跳转

parent 61feeae6
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
</view> </view>
<view class="content-accomplish"> <view class="content-accomplish">
<view class=""> <view class="">
截止1小时内支付完成 <text>00:59:42</text> 截止1小时内支付完成 <text>{{detailInfo.isEndTime}}</text>
</view> </view>
<button @click="jump(2)">立即支付 {{sumPrice}}</button> <button @click="jump(2)">立即支付 {{sumPrice}}</button>
</view> </view>
...@@ -52,7 +52,9 @@ ...@@ -52,7 +52,9 @@
</template> </template>
<script> <script>
import {userDiscountList} from '@/api/system/index.js' import {
userDiscountList
} from '@/api/system/index.js'
import apiBaseConfig from '@/config/index.js'; import apiBaseConfig from '@/config/index.js';
export default { export default {
data() { data() {
...@@ -62,8 +64,11 @@ ...@@ -62,8 +64,11 @@
scrollTopHeader: 0, scrollTopHeader: 0,
isUse: true, isUse: true,
detailInfo: {}, //详情数据 detailInfo: {}, //详情数据
payInfo:{}, payInfo: {},
discountList:[] discountList: [],
timer: "", //定时器
isEndTime: "", //倒计时要有个初始值
}; };
}, },
...@@ -74,44 +79,67 @@ ...@@ -74,44 +79,67 @@
let that = this let that = this
if (option.detailInfo) { if (option.detailInfo) {
this.detailInfo = JSON.parse(decodeURIComponent(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 => { uni.$on('payInfo', res => {
console.log(res,'打算今年');
that.payInfo = res that.payInfo = res
}) })
}, },
onUnload() { onUnload() {
uni.$off('payInfo') uni.$off('payInfo')
}, },
computed:{ computed: {
sumPrice(){ sumPrice() {
let that = this let that = this
// 1.判断优惠券是否有值并且价格大于优惠券时 // 1.判断优惠券是否有值并且价格大于优惠券时
// console.log(that.payInfo.fullSubtraction,that.detailInfo.actualAmount,'第三句话') // 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) // 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) return that.isUse ? Number((that.detailInfo.actualAmount - that.payInfo.fullSubtraction) * that
}else{ .discountList[0].discountRatio).toFixed(2) : Number(that.detailInfo.actualAmount - that.payInfo
if(that.discountList.length && that.discountList[0].discountRatio){ .fullSubtraction).toFixed(2)
return that.detailInfo.actualAmount && that.isUse ? Number(that.detailInfo.actualAmount * that.discountList[0].discountRatio).toFixed(2) : that.detailInfo.actualAmount } else {
}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 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: { methods: {
async getDisCountList(){ async getDisCountList() {
const data_back = await userDiscountList({useStatus:0}) const data_back = await userDiscountList({
const {code,rows,total} = data_back useStatus: 0
if(code === 200 && total > 0){ })
const {
code,
rows,
total
} = data_back
if (code === 200 && total > 0) {
this.discountList = rows this.discountList = rows
this.isUse = true this.isUse = true
}else{ } else {
this.isUse = false this.isUse = false
} }
}, },
...@@ -124,9 +152,9 @@ ...@@ -124,9 +152,9 @@
}); });
} else { } else {
let orderQuery = { let orderQuery = {
orderId:that.detailInfo.id,//订单的id orderId: that.detailInfo.id, //订单的id
couponId:that.payInfo.id ? that.payInfo.id : '',//优惠券的id couponId: that.payInfo.id ? that.payInfo.id : '', //优惠券的id
discountId:that.isUse && that.discountList.length ? that.discountList[0].id : '',//折扣的id discountId: that.isUse && that.discountList.length ? that.discountList[0].id : '', //折扣的id
} }
this.$uniGo.navigateTo({ this.$uniGo.navigateTo({
url: `/demand/confirm/index?orderQuery=${encodeURIComponent(JSON.stringify(orderQuery))}&sumPrice=${that.sumPrice}&title=${this.detailInfo.title}` url: `/demand/confirm/index?orderQuery=${encodeURIComponent(JSON.stringify(orderQuery))}&sumPrice=${that.sumPrice}&title=${this.detailInfo.title}`
......
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
<view class="index"> <view class="index">
<com-navbar :title="title" :titleStyle="{ color: '#000000', fontSize: '32rpx' }" /> <com-navbar :title="title" :titleStyle="{ color: '#000000', fontSize: '32rpx' }" />
<view class="index-content" v-if="useCouponList.length || couponLoseList.length"> <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"> <view class="index-content-item-nav baiyin-flex baiyin-flex-c-b">
<text></text> <text></text>
<view>可用优惠券{{cantotal}}</view> <view>可用优惠券{{cantotal}}</view>
</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> <image class="index-content-item-qu-bg" src="@/static/icon/xy01.png" mode=""></image>
<view class="index-content-item-qu-bl"> <view class="index-content-item-qu-bl">
<text class="index-content-item-qu-bl-tl">满减优惠券</text> <text class="index-content-item-qu-bl-tl">满减优惠券</text>
......
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
var eData = options.target.dataset; var eData = options.target.dataset;
console.log(eData.name); // shareBtn console.log(eData.name); // shareBtn
// 此处可以修改 shareObj 中的内容 // 此处可以修改 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) console.log("shareObj",shareObj)
// 返回shareObj // 返回shareObj
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
xcxCode:'' xcxCode:''
}, },
token:'', token:'',
InviterId:'',//邀请人的id inviterId:'',//邀请人的id
} }
}, },
onLoad(option) { onLoad(option) {
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
}) })
this.getUserInfo() this.getUserInfo()
if(option.id){ if(option.id){
this.InviterId = option.id this.inviterId = option.id
} }
}, },
methods: { methods: {
...@@ -56,9 +56,9 @@ ...@@ -56,9 +56,9 @@
async getSessionkeyAndOpenId(xcxCode) { async getSessionkeyAndOpenId(xcxCode) {
let that = this let that = this
let codeParams = {} let codeParams = {}
if(that.InviterId){ if(that.inviterId){
that.$set(codeParams,'xcxCode',xcxCode) that.$set(codeParams,'xcxCode',xcxCode)
that.$set(codeParams,'InviterId',that.InviterId) that.$set(codeParams,'inviterId',that.inviterId)
}else{ }else{
that.$set(codeParams,'xcxCode',xcxCode) that.$set(codeParams,'xcxCode',xcxCode)
} }
......
...@@ -49,8 +49,8 @@ ...@@ -49,8 +49,8 @@
<view class="buttoncolor" v-if="subscript == '3'"> <view class="buttoncolor" v-if="subscript == '3'">
<button v-if="item.status == 3" style="background: red;" class="buttoncl" <button v-if="item.status == 3" style="background: red;" class="buttoncl"
@click.stop="abolish(2,item)">退款</button> @click.stop="abolish(2,item)">退款</button>
<button v-else-if="item.status == 5 || item.status == 6" class="buttonclde buttonGray" <button v-else-if="item.status == 4 || item.status == 5 || item.status == 6" class="buttonclde buttonGray"
@click.stop="abolish(4,item)">{{item.status == 5 ? '退款中' : '已退款'}}</button> @click.stop="abolish(4,item)">{{item.status == 4 ? '已完成' : item.status == 5 ? '退款中' : item.status == 6 ? '已退款' : ''}}</button>
<button class="buttoncl" @click.stop="abolish(3,item)">详情</button> <button class="buttoncl" @click.stop="abolish(3,item)">详情</button>
</view> </view>
</view> </view>
......
...@@ -111,7 +111,7 @@ ...@@ -111,7 +111,7 @@
that.statusNeedList = [] that.statusNeedList = []
if (that.subscript == 3) { if (that.subscript == 3) {
that.$delete(that.needInfo, "status") that.$delete(that.needInfo, "status")
that.$set(that.needInfo, 'statusList', '3,5,6') that.$set(that.needInfo, 'statusList', '3,4,5,6')
} else { } else {
that.$delete(that.needInfo, "statusList") that.$delete(that.needInfo, "statusList")
} }
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
<image class="logo" src="/static//icon/sytb.png"></image> <image class="logo" src="/static//icon/sytb.png"></image>
<view :style="{ height: `calc(${globalData.statusBarHeight}rpx + 158rpx)` }"></view> <view :style="{ height: `calc(${globalData.statusBarHeight}rpx + 158rpx)` }"></view>
<view class="content-swiper"> <view class="content-swiper">
<u-swiper :list="swiperList" keyName="img" @change="e => (current = e.current)" :autoplay="true" <u-swiper circular :list="swiperList" keyName="img" @change="e => (current = e.current)" :autoplay="true"
height="300rpx"> height="300rpx" @click="handleSwiper">
<view slot="indicator" class="indicator"> <view slot="indicator" class="indicator">
<view class="indicator__dot" v-for="(item, index) in swiperList" :key="index" <view class="indicator__dot" v-for="(item, index) in swiperList" :key="index"
:class="[index === current && 'indicator__dot--active']"></view> :class="[index === current && 'indicator__dot--active']"></view>
...@@ -17,8 +17,9 @@ ...@@ -17,8 +17,9 @@
<view>用户需求广场</view> <view>用户需求广场</view>
</view> </view>
<view class="" v-if="userNeedList && userNeedList.length"> <view class="" v-if="userNeedList && userNeedList.length">
<view class="content-matter-marketplace" v-for="(v , index) in userNeedList" @click="clickJump(v)" :key="index"> <view class="content-matter-marketplace" v-for="(v , index) in userNeedList" @click="clickJump(v)"
<image :src="v.fileVos[0].url" mode=""></image> :key="index">
<image :src="v.pictureList[0].url" mode=""></image>
<view class="content-matter-marketplace-bazaar d-flex flex-column j-center"> <view class="content-matter-marketplace-bazaar d-flex flex-column j-center">
<view class=""> <view class="">
{{v.title}} {{v.title}}
...@@ -39,7 +40,8 @@ ...@@ -39,7 +40,8 @@
暂无数据 暂无数据
</view> </view>
</view> </view>
<u-loadmore v-if="userNeedList && userNeedList.length" iconSize="50px" @loadmore="loadMore" color="#6A6C6F" fontSize="24rpx" :nomore-text="nomoreText" :loading-text="loadingText" line :status="loadStatus" /> <u-loadmore v-if="userNeedList && userNeedList.length" iconSize="50px" @loadmore="loadMore" color="#6A6C6F"
fontSize="24rpx" :nomore-text="nomoreText" :loading-text="loadingText" line :status="loadStatus" />
</view> </view>
<com-navbar :leftIcon="false" :homeShow="false" bgColor="transparent" title="首页" <com-navbar :leftIcon="false" :homeShow="false" bgColor="transparent" title="首页"
:titleStyle="{ color: '#FFFFFF', fontSize: '32rpx',scrollTopHeader: scrollTopHeader }" /> :titleStyle="{ color: '#FFFFFF', fontSize: '32rpx',scrollTopHeader: scrollTopHeader }" />
...@@ -48,13 +50,20 @@ ...@@ -48,13 +50,20 @@
</template> </template>
<script> <script>
import { userNeedSquare } from '@/api/system/index.js' import {
userNeedSquare
} from '@/api/system/index.js'
export default { export default {
data() { data() {
return { return {
title: 'Hello', title: 'Hello',
globalData: getApp().globalData, globalData: getApp().globalData,
scrollTopHeader: 0, scrollTopHeader: 0,
swiperList: [
'https://cdn.uviewui.com/uview/swiper/swiper1.png',
'https://cdn.uviewui.com/uview/swiper/swiper2.png',
'https://cdn.uviewui.com/uview/swiper/swiper3.png',
],
tabBarList: [{ tabBarList: [{
name: "首页", // name name: "首页", // name
icon: "/static/tabbar/tb1.png", // 图标 icon: "/static/tabbar/tb1.png", // 图标
...@@ -86,13 +95,13 @@ ...@@ -86,13 +95,13 @@
url: "/pages/my/index", url: "/pages/my/index",
type: 'type' type: 'type'
}], }],
userNeedList:[],//需求广场列表 userNeedList: [], //需求广场列表
total:0,//列表总数 total: 0, //列表总数
queryParams:{ queryParams: {
pageNum:1, pageNum: 1,
pageSize:10, pageSize: 10,
}, },
loadStatus:'loading',//加载时的状态(loadmore/ loading / nomore) loadStatus: 'loading', //加载时的状态(loadmore/ loading / nomore)
loadingText: '正在加载', loadingText: '正在加载',
nomoreText: '已经到底了' nomoreText: '已经到底了'
} }
...@@ -105,25 +114,25 @@ ...@@ -105,25 +114,25 @@
}, },
onReachBottom() { onReachBottom() {
let that = this let that = this
if(that.total < that.queryParams.pageNum * that.queryParams.pageSize) return that.nomore = 'nomore' if (that.total < that.queryParams.pageNum * that.queryParams.pageSize) return that.nomore = 'nomore'
that.queryParams.pageNum++ that.queryParams.pageNum++
that.getSquare() that.getSquare()
}, },
methods: { methods: {
getSquare(){ getSquare() {
let that = this let that = this
userNeedSquare(this.queryParams).then(res=>{ userNeedSquare(this.queryParams).then(res => {
console.log(res,'需求广场') console.log(res, '需求广场')
if(res.code == 200){ if (res.code == 200) {
if(res.total > 0){ if (res.total > 0) {
that.total = res.total that.total = res.total
if(that.total <= that.queryParams.pageSize){ if (that.total <= that.queryParams.pageSize) {
that.loadStatus = 'nomore' that.loadStatus = 'nomore'
} }
if(that.queryParams.pageNum == 1){ if (that.queryParams.pageNum == 1) {
that.userNeedList = res.rows that.userNeedList = res.rows
}else{ } else {
that.userNeedList = [...that.userNeedList,...res.rows] that.userNeedList = [...that.userNeedList, ...res.rows]
} }
} }
...@@ -135,7 +144,19 @@ ...@@ -135,7 +144,19 @@
url: `/home/index/index?id=${info.id}` url: `/home/index/index?id=${info.id}`
}); });
}, },
loadMore(){ handleSwiper(index){
console.log(index,'下表')
let data = {
id: "1645720411777540114"
}
let subscript = 1
this.$uniGo.navigateTo({
url: `/demand/index/index?detailInfo=${encodeURIComponent(JSON.stringify(data))}&subscript=${subscript}`
// url: `/demand/index/index?subscript=${this.subscript}`
});
},
loadMore() {
console.log('加载更多') console.log('加载更多')
} }
} }
......
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