Browse Source

Merge branch 'master' of ssh://8.134.10.79:222/Leadfyy.co/ec.uniapp-master

# Conflicts:
#	pages/shop/goodsdetail.vue
master
邓平艺 4 years ago
parent
commit
db8e48d6ce
  1. 24
      components/uni-countdown/uni-countdown.vue
  2. 15
      pages/order/newdetail/newdetail.vue
  3. 135
      pages/shop/goodsdetail.vue
  4. 51
      pages/shop/seckillList.vue

24
components/uni-countdown/uni-countdown.vue

@ -1,15 +1,15 @@
<template> <template>
<view class="uni-countdown"> <view class="uni-countdown">
<text v-if="showDay" :style="{ borderColor: borderColor, color: color, backgroundColor: backgroundColor }"
<text v-if="showDay" :style="{ borderColor: borderColor, color: color }"
class="uni-countdown__number">{{ d }}</text> class="uni-countdown__number">{{ d }}</text>
<text v-if="showDay" :style="{ color: splitorColor }" class="uni-countdown__splitor">{{dayText}}</text> <text v-if="showDay" :style="{ color: splitorColor }" class="uni-countdown__splitor">{{dayText}}</text>
<text :style="{ borderColor: borderColor, color: color, backgroundColor: backgroundColor }"
<text v-if="showHour" :style="{ borderColor: borderColor, color: color }"
class="uni-countdown__number">{{ h }}</text> class="uni-countdown__number">{{ h }}</text>
<text :style="{ color: splitorColor }" class="uni-countdown__splitor">{{ showColon ? ':' : hourText }}</text>
<text :style="{ borderColor: borderColor, color: color, backgroundColor: backgroundColor }"
<text v-if="showHour" :style="{ color: splitorColor }" class="uni-countdown__splitor">{{ showColon ? '' : hourText }}</text>
<text :style="{ borderColor: borderColor, color: color }"
class="uni-countdown__number">{{ i }}</text> class="uni-countdown__number">{{ i }}</text>
<text :style="{ color: splitorColor }" class="uni-countdown__splitor">{{ showColon ? ':' : minuteText }}</text>
<text :style="{ borderColor: borderColor, color: color, backgroundColor: backgroundColor }"
<text :style="{ color: splitorColor }" class="uni-countdown__splitor">{{ showColon ? '' : minuteText }}</text>
<text :style="{ borderColor: borderColor, color: color }"
class="uni-countdown__number">{{ s }}</text> class="uni-countdown__number">{{ s }}</text>
<text v-if="!showColon" :style="{ color: splitorColor }" class="uni-countdown__splitor">{{secondText}}</text> <text v-if="!showColon" :style="{ color: splitorColor }" class="uni-countdown__splitor">{{secondText}}</text>
</view> </view>
@ -45,6 +45,10 @@
type: Boolean, type: Boolean,
default: true default: true
}, },
showHour: {
type: Boolean,
default: true
},
showColon: { showColon: {
type: Boolean, type: Boolean,
default: true default: true
@ -59,15 +63,15 @@
}, },
borderColor: { borderColor: {
type: String, type: String,
default: '#000000'
default: '#15716E'
}, },
color: { color: {
type: String, type: String,
default: '#000000'
default: '#15716E'
}, },
splitorColor: { splitorColor: {
type: String, type: String,
default: '#000000'
default: '#15716E'
}, },
day: { day: {
type: Number, type: Number,
@ -250,8 +254,6 @@
/* #endif */ /* #endif */
justify-content: center; justify-content: center;
align-items: center; align-items: center;
width: $countdown-width;
height: $countdown-height;
line-height: $countdown-height; line-height: $countdown-height;
margin: 5rpx; margin: 5rpx;
text-align: center; text-align: center;

15
pages/order/newdetail/newdetail.vue

@ -6,7 +6,7 @@
<view class="lf-font-24 lf-color-white">剩余支付时间</view> <view class="lf-font-24 lf-color-white">剩余支付时间</view>
<view class="lf-font-24 lf-color-white"> <view class="lf-font-24 lf-color-white">
<!-- {{time}} --> <!-- {{time}} -->
<countdown-timer :time="time" :autoStart="true" @finish="dateFinish">
<!-- <countdown-timer :time="time" :autoStart="true" @finish="dateFinish">
<template v-slot="{minute, second}"> <template v-slot="{minute, second}">
<view class="lf-flex"> <view class="lf-flex">
<view class="lf-font-24 lf-color-white">{{ minute >= 10 ? minute : "0" + minute }}</view> <view class="lf-font-24 lf-color-white">{{ minute >= 10 ? minute : "0" + minute }}</view>
@ -14,7 +14,14 @@
<view class="lf-font-24 lf-color-white">{{ second >= 10 ? second : "0" + second }}</view> <view class="lf-font-24 lf-color-white">{{ second >= 10 ? second : "0" + second }}</view>
</view> </view>
</template> </template>
</countdown-timer>
</countdown-timer> -->
<countdown-time
:showDay="false"
:day="order_details.last_pay_time[0]"
:hour="order_details.last_pay_time[1]"
:minute="order_details.last_pay_time[2]"
:second="order_details.last_pay_time[3]">
</countdown-time>
</view> </view>
</view> </view>
<!-- 待收货 --> <!-- 待收货 -->
@ -205,7 +212,7 @@
<script> <script>
import lfQrcode from '@/components/lf-code/lf-qrcode.vue'; import lfQrcode from '@/components/lf-code/lf-qrcode.vue';
import countdownTimer from '@/components/countdown-timer/countdown-timer';
import countdownTime from '@/components/uni-countdown/uni-countdown.vue';
export default { export default {
data() { data() {
return { return {
@ -241,7 +248,7 @@
} }
}, },
components: { components: {
countdownTimer,
countdownTime,
lfQrcode lfQrcode
}, },
onLoad(options) { onLoad(options) {

135
pages/shop/goodsdetail.vue

@ -9,23 +9,6 @@
<image mode="aspectFill" :src="item" style="width: 100%; height: 100%;" @click="lookImg(index)"></image> <image mode="aspectFill" :src="item" style="width: 100%; height: 100%;" @click="lookImg(index)"></image>
<view class="seckill-box" v-if="type == 'seckill'"> <view class="seckill-box" v-if="type == 'seckill'">
<view>距离结束还剩余</view> <view>距离结束还剩余</view>
<!-- <view v-if="$isRight(time)">
<countdown-timer :time="time" :autoStart="true" @finish="dateFinish">
<template v-slot="{day, hour, minute, second}">
<view class="lf-flex">
<view>{{ day }}</view>
<view></view>
<view>{{ hour >= 10 ? hour : "0" + hour }}</view>
<view></view>
<view>{{ minute >= 10 ? minute : "0" + minute }}</view>
<view></view>
<view>{{ second >= 10 ? second : "0" + second }}</view>
<view></view>
</view>
</template>
</countdown-timer>
</view> -->
<view v-if="$isRight(seckill)"> <view v-if="$isRight(seckill)">
<countdown-time <countdown-time
:day="seckill.seckill.end_left_time[0]" :day="seckill.seckill.end_left_time[0]"
@ -34,7 +17,6 @@
:second="seckill.seckill.end_left_time[3]"> :second="seckill.seckill.end_left_time[3]">
</countdown-time> </countdown-time>
</view> </view>
</view> </view>
</swiper-item> </swiper-item>
</swiper> </swiper>
@ -187,7 +169,7 @@
<button class="btn" style="width: 349rpx;" @click="shoot(2)">立即秒杀</button> <button class="btn" style="width: 349rpx;" @click="shoot(2)">立即秒杀</button>
</view> </view>
<view v-else-if="type == 'point'"> <view v-else-if="type == 'point'">
<button class="btn" style="width: 349rpx;" @click="goExchange()">立即兑换</button>
<button class="btn" style="width: 349rpx;">立即兑换</button>
</view> </view>
<view class="lf-flex" v-else> <view class="lf-flex" v-else>
<button class="btn1" @click="shoot(1)">加入购物车</button> <button class="btn1" @click="shoot(1)">加入购物车</button>
@ -278,9 +260,7 @@
token: '', token: '',
coupons: [], // coupons: [], //
goods_num: 1, goods_num: 1,
is_date_finish: false,
show_share: false,
shareImg: ''
is_date_finish: false
} }
}, },
computed: { computed: {
@ -329,11 +309,6 @@
this.getGoodsStock(); // this.getGoodsStock(); //
}, },
methods: { methods: {
goExchange() {
if(this.showSpec == '请选择规格') {
this.shoot(3)
}
},
// //
switchCollect(){ switchCollect(){
if(!this.token){ if(!this.token){
@ -406,7 +381,7 @@
} }
} }
}, },
//
// TODO
confirm(){ confirm(){
if(this.is_date_finish){ if(this.is_date_finish){
return this.$msg('活动已结束'); return this.$msg('活动已结束');
@ -474,6 +449,8 @@
delete par.product_id; delete par.product_id;
par.seckill_goods_id = this.seckill.item_id; par.seckill_goods_id = this.seckill.item_id;
par.seckill_item_id = this.seckill.id; par.seckill_item_id = this.seckill.id;
par.price = this.seckill.seckill_price;
par.total = this.goods_num;
} }
@ -501,7 +478,7 @@
// //
this.$cookieStorage.set('order_confirm', par); this.$cookieStorage.set('order_confirm', par);
uni.hideLoading(); uni.hideLoading();
this.$url('/pages/order/confirm/confirm?goods_type=1');
this.$url('/pages/order/confirm/confirm');
// this.$http.post({ // this.$http.post({
// api: 'api/shopping/order/checkout', // api: 'api/shopping/order/checkout',
// data: par, // data: par,
@ -516,73 +493,50 @@
// } // }
// uni.hideLoading() // uni.hideLoading()
// }).catch(err => uni.hideLoading()) // }).catch(err => uni.hideLoading())
}else if(this.click_type == 3) {
//
this.$cookieStorage.set('order_confirm', par);
uni.hideLoading();
this.$url('/pages/order/confirm/confirm?goods_type=0');
} }
}, },
// //
shareGraphic(){ shareGraphic(){
this.getShearImg();
this.getCreateShareImg();
}, },
//
getShearImg() {
wx.showLoading({
title: "生成中",
mask: true
});
var token = this.token;
this.$http.get({
api: 'api/distribution/createMiniShareImg',
header: {
Authorization: token
},
data: {
goods_id: this.goods_id
}
}).then(res => {
if (res.statusCode == 200) {
res = res.data;
if (res.status) {
this.setData({
shareImg: res.data.image
});
setTimeout(() => {
this.changeImg();
}, 100)
} else {
wx.showModal({
content: res.message || '请求失败',
showCancel: false
});
}
} else {
wx.showModal({
content: '请求失败',
showCancel: false
});
}
//h5
getCreateShareImg(){
wx.showLoading({
title:"生成中",
mask:true
})
let origin = window.location.origin;
let share_url = origin+'/pages/store/detail/detail';
this.$http.get({
api:'api/distribution/createH5ShareImg',
data:{
goods_id:this.id,
share_url:share_url
}
}).then(res=>{
res = res.data;
if(res.status){
this.qr_code_image = res.data.image;
wx.hideLoading();
this.changeShare();
}).catch(rej => {
wx.showModal({
content: '内部错误',
showCancel: false
});
wx.hideLoading();
this.changeShare();
});
},
//
changeShare() {
this.setData({
show_share: !this.show_share
});
if(this.qr_code_image){
this.share_gaphic =!this.share_gaphic;
this.is_toggle_share = false;
}
} else{
wx.showModal({
content: res.message || '请求失败,请重试',
showCancel: false
});
}
wx.hideLoading()
}).catch(rej=>{
wx.hideLoading()
wx.showModal({
content: rej.message || '内部错误,请重试',
showCancel: false
});
})
}, },
// //
getNewdetail(){ getNewdetail(){
@ -607,7 +561,6 @@
this.seckill = meta.seckill; this.seckill = meta.seckill;
let currentDate = this.$shared.recordTime(); let currentDate = this.$shared.recordTime();
this.time = new Date(meta.seckill.ends_at).getTime() - new Date(currentDate).getTime() this.time = new Date(meta.seckill.ends_at).getTime() - new Date(currentDate).getTime()
console.log("time", this.time, meta.seckill.ends_at, currentDate)
} }
if(type != 'point'){ if(type != 'point'){
this.getBrandDetail(goods_detail.brand_id); this.getBrandDetail(goods_detail.brand_id);

51
pages/shop/seckillList.vue

@ -54,7 +54,7 @@
</view> --> </view> -->
<view class="desc" v-if="item.seckill.end_left_time.length==0"> <view class="desc" v-if="item.seckill.end_left_time.length==0">
距离开始还剩余 距离开始还剩余
<countdown-time :day="item.seckill.end_left_time[0]" :hour="item.seckill.end_left_time[1]" :minute="item.seckill.end_left_time[2]" :second="item.seckill.end_left_time[3]">
<countdown-time :day="item.seckill.start_left_time[0]" :hour="item.seckill.start_left_time[1]" :minute="item.seckill.start_left_time[2]" :second="item.seckill.start_left_time[3]">
</countdown-time> </countdown-time>
</view> </view>
@ -85,7 +85,6 @@
</template> </template>
<script> <script>
import countdownTimer from '@/components/countdown-timer/countdown-timer';
import countdownTime from '@/components/uni-countdown/uni-countdown.vue'; import countdownTime from '@/components/uni-countdown/uni-countdown.vue';
export default { export default {
data() { data() {
@ -107,7 +106,6 @@
} }
}, },
components: { components: {
countdownTimer,
countdownTime countdownTime
}, },
computed: { computed: {
@ -174,52 +172,9 @@
this.isRefresher = false; this.isRefresher = false;
} }
if (this.page == 1) { if (this.page == 1) {
let list = res.data.data;
list.forEach((item,index) => {
let now_date = new Date(new Date().toLocaleDateString()).getTime();
let start_date = new Date(new Date(item.seckill.starts_at).toLocaleDateString()).getTime();
console.log(now_date)
console.log(start_date)
console.log(item)
if(now_date < start_date) {
this.$set(item,'ifStart',false)
var date = this.getTime()
let time = new Date(item.seckill.starts_at).getTime() - new Date(date).getTime()
this.$set(item,'countTime',time)
console.log("time", time);
}else {
this.$set(item,'ifStart',true)
var date = this.getTime()
let time = new Date(item.seckill.ends_at).getTime() - new Date(date).getTime()
this.$set(item,'countTime',time)
console.log("time", time);
}
})
this.list = list
console.log(this.list)
this.list = res.data.data;
} else { } else {
let list = res.data.data;
list.forEach((item,index) => {
let now_date = new Date(new Date().toLocaleDateString()).getTime();
let start_date = new Date(new Date(item.seckill.starts_at).toLocaleDateString()).getTime();
console.log(now_date)
console.log(start_date)
console.log(item)
if(now_date < start_date) {
this.$set(item,'ifStart',false)
var date = this.getTime()
let time = new Date(item.seckill.starts_at).getTime() - new Date(date).getTime()
this.$set(item,'countTime',time)
}else {
this.$set(item,'ifStart',true)
var date = this.getTime()
let time = new Date(item.seckill.ends_at).getTime() - new Date(date).getTime()
this.$set(item,'countTime',time)
}
})
this.list.push(...list);
this.list.push(...res.data.data);
} }
}) })

Loading…
Cancel
Save