Browse Source

修复部分显示bug

zyh
Aaron 4 years ago
parent
commit
f2596c53a3
  1. 83
      components/CountDown.vue
  2. 1
      components/ProductWindow.vue
  3. 3
      pages/activity/GoodsSeckill/index.vue
  4. 36
      pages/activity/GroupDetails/index.vue
  5. 4
      pages/home/index.vue
  6. 9
      pages/order/OrderSubmission/index.vue
  7. 17
      pages/shop/GoodsList/index.vue
  8. 4
      pages/shop/ShoppingCart/index.vue
  9. 12
      pages/user/User/index.vue

83
components/CountDown.vue

@ -42,8 +42,9 @@ export default {
default: true, default: true,
}, },
}, },
data: function() { data() {
return { return {
timeInterval: null,
time: this.datatime, time: this.datatime,
day: '00', day: '00',
hour: '00', hour: '00',
@ -51,7 +52,7 @@ export default {
second: '00', second: '00',
} }
}, },
created: function() { created() {
this.show_time() this.show_time()
}, },
watch: { watch: {
@ -61,10 +62,11 @@ export default {
this.show_time() this.show_time()
}, },
}, },
mounted: function() {}, mounted() {
},
methods: { methods: {
show_time: function() { show_time() {
let that = this console.log(this.datatime)
if (this.time.toString().length == 13) { if (this.time.toString().length == 13) {
// //
console.log('毫秒') console.log('毫秒')
@ -77,41 +79,44 @@ export default {
console.log('时间') console.log('时间')
this.time = Date.parse(this.time) / 1000 this.time = Date.parse(this.time) / 1000
} }
this.runTime()
function runTime() { this.timeInterval = setInterval(this.runTime, 1000)
//
let intDiff = that.time - Date.parse(new Date()) / 1000 //
let day = 0,
hour = 0,
minute = 0,
second = 0
if (intDiff > 0) {
//
if (that.isDay === true) {
day = Math.floor(intDiff / (60 * 60 * 24))
} else {
day = 0
}
hour = Math.floor(intDiff / (60 * 60)) - day * 24
minute = Math.floor(intDiff / 60) - day * 24 * 60 - hour * 60
second = Math.floor(intDiff) - day * 24 * 60 * 60 - hour * 60 * 60 - minute * 60
if (hour <= 9) hour = '0' + hour
if (minute <= 9) minute = '0' + minute
if (second <= 9) second = '0' + second
that.day = day
that.hour = hour
that.minute = minute
that.second = second
} else {
that.day = '00'
that.hour = '00'
that.minute = '00'
that.second = '00'
}
}
runTime()
this.timeInterval = setInterval(runTime, 1000)
}, },
runTime() {
//
let intDiff = this.time - Date.parse(new Date()) / 1000 //
console.log(intDiff)
let day = 0,
hour = 0,
minute = 0,
second = 0
if (intDiff > 0) {
//
if (this.isDay === true) {
day = Math.floor(intDiff / (60 * 60 * 24))
} else {
day = 0
}
hour = Math.floor(intDiff / (60 * 60)) - day * 24
minute = Math.floor(intDiff / 60) - day * 24 * 60 - hour * 60
second = Math.floor(intDiff) - day * 24 * 60 * 60 - hour * 60 * 60 - minute * 60
if (hour <= 9) hour = '0' + hour
if (minute <= 9) minute = '0' + minute
if (second <= 9) second = '0' + second
this.day = day
this.hour = hour
this.minute = minute
this.second = second
} else {
this.day = '00'
this.hour = '00'
this.minute = '00'
this.second = '00'
}
}
}, },
destroyed() {
clearTimeout(this.timeInterval)
}
} }
</script> </script>

1
components/ProductWindow.vue

@ -83,6 +83,7 @@ export default {
return {}; return {};
}, },
mounted: function () { mounted: function () {
console.log(this.attr)
console.log(this); console.log(this);
}, },
watch: { watch: {

3
pages/activity/GoodsSeckill/index.vue

@ -37,7 +37,7 @@
</view> </view>
<view class="tui-countdown__box" v-if="item.status == 1 || item.status == 2"> <view class="tui-countdown__box" v-if="item.status == 1 || item.status == 2">
<text>距离{{ item.status == 1 ? '结束还剩' : '开始还有' }}</text> <text>距离{{ item.status == 1 ? '结束还剩' : '开始还有' }}</text>
<count-down :isDay="true" :tipText="'倒计时 '" :dayText="' 天 '" :hourText="' 时 '" :minuteText="' 分 '" :secondText="' 秒'" :datatime="item.stop"></count-down> <CountDown :isDay="true" :tipText="'倒计时 '" :dayText="' 天 '" :hourText="' 时 '" :minuteText="' 分 '" :secondText="' 秒'" :datatime="item.stop"></CountDown>
</view> </view>
</view> </view>
</block> </block>
@ -163,6 +163,7 @@ export default {
that.status = false that.status = false
that.active = index that.active = index
that.datatime = that.timeList[that.active].stop that.datatime = that.timeList[that.active].stop
console.log(new Date(that.datatime))
this.seckillList = [] this.seckillList = []
that.getSeckillList() that.getSeckillList()
}, },

36
pages/activity/GroupDetails/index.vue

@ -260,7 +260,7 @@ export default {
}, },
methods: { methods: {
formatPrice(price, index) { formatPrice(price, index) {
console.log(price) // console.log(price)
if (price) { if (price) {
return price.split('.')[index] return price.split('.')[index]
} }
@ -284,15 +284,6 @@ export default {
}, },
} }
}, },
openAlone: function() {
this.$yrouter.push({
path: '/pages/shop/GoodsCon/index',
query: {
id: this.storeInfo.productId,
},
})
// this.$yrouter.replace({ path: "/detail/" + this.storeInfo.productId });
},
// //
setCollect: function() { setCollect: function() {
let that = this, let that = this,
@ -452,24 +443,41 @@ export default {
this.$set(this, 'attrTxt', '请选择') this.$set(this, 'attrTxt', '请选择')
} }
}, },
//
openAlone: function() {
this.$yrouter.push({
path: '/pages/shop/GoodsCon/index',
query: {
id: this.storeInfo.productId,
},
})
// this.$yrouter.replace({ path: "/detail/" + this.storeInfo.productId });
},
//
openTeam: function() { openTeam: function() {
var that = this var that = this
if (that.attr.cartAttr == false) { console.log(this.attr)
if (that.attr.cartAttr == false) { //
console.log(this.attr.cartAttr)
that.attr.cartAttr = !this.attr.cartAttr that.attr.cartAttr = !this.attr.cartAttr
} else { //
that.attr.productSelect.price = this.storeInfo.price
} else { //
var data = {} var data = {}
data.productId = that.storeInfo.productId data.productId = that.storeInfo.productId
data.price = that.storeInfo.price
data.cartNum = that.attr.productSelect.cart_num data.cartNum = that.attr.productSelect.cart_num
data.uniqueId = that.attr.productSelect.unique data.uniqueId = that.attr.productSelect.unique
data.combinationId = that.storeInfo.id data.combinationId = that.storeInfo.id
data.new = 1 data.new = 1
console.log(data)
postCartAdd(data) postCartAdd(data)
.then(res => { .then(res => {
that.$yrouter.push({ that.$yrouter.push({
path: '/pages/order/OrderSubmission/index', path: '/pages/order/OrderSubmission/index',
query: { query: {
id: res.data.cartId, // id: res.data.cartId,
pinkId: res.data.cartId,
}, },
}) })
}) })

4
pages/home/index.vue

@ -46,6 +46,10 @@
<PromotionGood v-if="item.type == 'promotionGood'" :benefit="benefit"></PromotionGood> <PromotionGood v-if="item.type == 'promotionGood'" :benefit="benefit"></PromotionGood>
<Coupon-window :coupon-list="couponList" v-if="showCoupon" @checked="couponClose" @close="couponClose"> </Coupon-window> <Coupon-window :coupon-list="couponList" v-if="showCoupon" @checked="couponClose" @close="couponClose"> </Coupon-window>
</view> </view>
<!-- <view class="demo" style='height:100rpx'></view> -->
<!-- #ifndef APP-PLUS -->
<view class="bottomSpace" style='line-height:100rpx'>PC</view>
<!-- #endif -->
</view> </view>
</template> </template>
<script> <script>

9
pages/order/OrderSubmission/index.vue

@ -312,9 +312,9 @@ export default {
}, },
onLoad: function() { onLoad: function() {
let that = this let that = this
console.log('loadddddddd')
this.$store.dispatch('getUser', true) this.$store.dispatch('getUser', true)
that.getCartInfo() that.getCartInfo()
console.log(that.$yroute) console.log(that.$yroute)
if (that.$yroute.query.pinkid !== undefined) { if (that.$yroute.query.pinkid !== undefined) {
that.pinkId = that.$yroute.query.pinkid that.pinkId = that.$yroute.query.pinkid
@ -355,6 +355,7 @@ export default {
} }
this.useIntegral = e.mp.detail.value[0] this.useIntegral = e.mp.detail.value[0]
}, },
//
computedPrice() { computedPrice() {
let shipping_type = this.shipping_type let shipping_type = this.shipping_type
postOrderComputed(this.orderGroupInfo.orderKey, { postOrderComputed(this.orderGroupInfo.orderKey, {
@ -377,7 +378,11 @@ export default {
}) })
}, },
getCartInfo() { getCartInfo() {
const cartIds = this.$yroute.query.id let cartIds = this.$yroute.query.id
// id
if (this.$yroute.query.pinkId) {
cartIds = this.$yroute.query.pinkId
}
if (!cartIds) { if (!cartIds) {
uni.showToast({ uni.showToast({
title: '参数有误', title: '参数有误',

17
pages/shop/GoodsList/index.vue

@ -173,7 +173,6 @@ export default {
}) })
}, },
getProductList() { getProductList() {
var that = this
this.setWhere() this.setWhere()
const { s = '', id = 0, title = '' } = this.$yroute.query const { s = '', id = 0, title = '' } = this.$yroute.query
if (s !== this.where.keyword || id !== this.where.sid) { if (s !== this.where.keyword || id !== this.where.sid) {
@ -188,18 +187,18 @@ export default {
this.stock = 0 this.stock = 0
// this.getProductList(); // this.getProductList();
} }
let q = that.where let q = this.where
let getData = this.isIntegral !== 'true' ? getProducts : getProductsIntegral let getData = this.isIntegral !== 'true' ? getProducts : getProductsIntegral
getData(q).then(res => { getData(q).then(res => {
that.loading = false this.loading = false
if (that.target) { if (this.target) {
that.productList = res.data this.productList = res.data
} else { } else {
that.productList.push.apply(that.productList, res.data) this.productList.push.apply(this.productList, res.data)
} }
that.target = false this.target = false
that.loadend = res.data.length < that.where.limit // this.loadend = res.data.length < this.where.limit //
that.where.page = that.where.page + 1 this.where.page = this.where.page + 1
}) })
}, },
submitForm: function() { submitForm: function() {

4
pages/shop/ShoppingCart/index.vue

@ -520,5 +520,9 @@
} }
.shoppingCart{ .shoppingCart{
position: relative; position: relative;
.list{
margin-top: 150rpx;
padding-top: 15rpx;
}
} }
</style> </style>

12
pages/user/User/index.vue

@ -272,22 +272,22 @@ export default {
}) })
} }
}, },
changeswitch: function(data) { changeswitch(data) {
this.switchActive = data this.switchActive = data
}, },
MenuUser: function() { //
let that = this MenuUser() {
getMenuUser() getMenuUser()
.then(res => { .then(res => {
uni.hideLoading() uni.hideLoading()
that.MyMenus = res.data.routine_my_menus this.MyMenus = res.data.routine_my_menus
}) })
.catch(error => { .catch(error => {
uni.hideLoading() uni.hideLoading()
console.log(error) console.log(error)
}) })
}, },
goPages: function(index) { goPages(index) {
let url = this.MyMenus[index].uniapp_url let url = this.MyMenus[index].uniapp_url
if (url === '/pages/user/promotion/UserPromotion/index' && this.userInfo.statu === 1) { if (url === '/pages/user/promotion/UserPromotion/index' && this.userInfo.statu === 1) {
if (!this.userInfo.isPromoter) { if (!this.userInfo.isPromoter) {
@ -322,7 +322,7 @@ export default {
path: this.MyMenus[index].uniapp_url, path: this.MyMenus[index].uniapp_url,
}) })
}, },
goPages2: function() { goPages2() {
this.$yrouter.push({ this.$yrouter.push({
path: '/pages/shop/GoodsList/index', path: '/pages/shop/GoodsList/index',
query: { query: {

Loading…
Cancel
Save