7.16
This commit is contained in:
@@ -37,17 +37,17 @@
|
||||
<view>
|
||||
<view class="title">优惠券折扣</view>
|
||||
<view class="value">
|
||||
<view>-¥10.00</view>
|
||||
<view>{{ index }}</view>
|
||||
<image src="../static/image/1.png"></image>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view>
|
||||
<view class="title">支付方式</view>
|
||||
<view>
|
||||
<view class="title">运费</view>
|
||||
<view class="value">
|
||||
<view>微信</view>
|
||||
<image src="../static/image/1.png"></image>
|
||||
<view v-if="freight">¥{{ freight | setFreight(index) }}</view>
|
||||
<!-- <image src="../static/image/1.png"></image> -->
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -59,10 +59,10 @@
|
||||
<image src="../static/image/1.png"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<view @click="showDelivery=true">
|
||||
<view class="title">配送方式</view>
|
||||
<view class="value">
|
||||
<view>快递</view>
|
||||
<view>{{ delivery.text }}</view>
|
||||
<image src="../static/image/1.png"></image>
|
||||
</view>
|
||||
</view>
|
||||
@@ -70,36 +70,40 @@
|
||||
<view class="bottom">
|
||||
<view class="left">
|
||||
<view class="title">合计:</view>
|
||||
<view class="price">¥{{ orderInfo.store_goods_total | showTotalPrice }}</view>
|
||||
<view class="price">¥{{ totalPrice }}</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<view class="num">共件{{ orderInfo.store_cart_list | setTotalNumber }}商品</view>
|
||||
<view class="btn" @click="sendOrder">结算</view>
|
||||
</view>
|
||||
</view>
|
||||
<u-action-sheet :list="deliveryList" @click="setDelivery" border-radius="10" v-model="showDelivery"></u-action-sheet>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
showDelivery: false,
|
||||
orderInfo: {},
|
||||
totalPrice: '0.00',
|
||||
addressInfo: {},
|
||||
freight: '',
|
||||
freight: {}, // 运费
|
||||
isTakeawayer: '', // 是否支持骑手
|
||||
deliveryList: [{
|
||||
text: '快递',
|
||||
value: 'express',
|
||||
}, {
|
||||
text: '骑手',
|
||||
value: 'takeawayer',
|
||||
}],
|
||||
delivery: {
|
||||
text: '快递',
|
||||
value: 'express',
|
||||
}, // 配送方式
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
showTotalPrice(object) {
|
||||
let price = 0;
|
||||
for (const key in object) {
|
||||
if (object.hasOwnProperty(key)) {
|
||||
const element = object[key];
|
||||
price += Number(element);
|
||||
}
|
||||
}
|
||||
return price.toFixed(2);
|
||||
},
|
||||
setTotalNumber(data) {
|
||||
let num = 0;
|
||||
for (const key in data) {
|
||||
@@ -112,12 +116,29 @@ export default {
|
||||
}
|
||||
return num;
|
||||
},
|
||||
setFreight(freight, index) {
|
||||
return freight[index];
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
console.log(JSON.parse(option.info));
|
||||
this.orderInfo = JSON.parse(option.info);
|
||||
this.addressInfo = this.orderInfo.address_info;
|
||||
this.getFreight();
|
||||
this.orderInfo = this.$store.state.cartInfo;
|
||||
},
|
||||
onShow() {
|
||||
// 判断是不是从选择地址页面返回
|
||||
if(JSON.stringify(this.$store.state.orderAddress) == '{}') {
|
||||
this.$store.commit('updateAddress', this.orderInfo.address_info);
|
||||
} else {
|
||||
this.addressInfo = this.$store.state.orderAddress;
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$store.commit('updateAddress', {});
|
||||
},
|
||||
watch: {
|
||||
'$store.state.orderAddress'(value) {
|
||||
this.addressInfo = value;
|
||||
this.getFreight();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
sendOrder() {
|
||||
@@ -156,12 +177,38 @@ export default {
|
||||
freight_hash: this.orderInfo.freight_hash,
|
||||
city_id: this.addressInfo.city_id,
|
||||
area_id: this.addressInfo.area_id,
|
||||
delivery: this.delivery.value,
|
||||
}).then(res => {
|
||||
if(res.errCode == 0) {
|
||||
// this.freight = res.
|
||||
this.freight = res.data.content;
|
||||
this.isTakeawayer = res.data.delivery.takeawayer;
|
||||
this.setTotalPrice(); // 计算总价
|
||||
}
|
||||
})
|
||||
},
|
||||
setTotalPrice(object) {
|
||||
const goods = this.orderInfo.store_goods_total;
|
||||
const freight = this.freight;
|
||||
let price = 0;
|
||||
[goods, freight].forEach(object => {
|
||||
for (const key in object) {
|
||||
if (object.hasOwnProperty(key)) {
|
||||
const element = object[key];
|
||||
price += Number(element);
|
||||
}
|
||||
}
|
||||
})
|
||||
// console.log(price);
|
||||
this.totalPrice = price.toFixed(2);
|
||||
},
|
||||
setDelivery(index) {
|
||||
if(index == 1) {
|
||||
if(!this.isTakeawayer) this.$u.toast('此地区不支持骑手配送');
|
||||
return false;
|
||||
}
|
||||
this.delivery = this.deliveryList[index];
|
||||
this.getFreight();
|
||||
},
|
||||
settlement() {
|
||||
uni.navigateTo({
|
||||
url: '/pageE/order/Details'
|
||||
@@ -169,7 +216,7 @@ export default {
|
||||
},
|
||||
changeAddress() {
|
||||
uni.navigateTo({
|
||||
url: '/pageE/more/Address'
|
||||
url: '/pageE/more/Address?type=choose'
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@@ -100,11 +100,9 @@ export default {
|
||||
// ifcart 结算方式 1:购物车 0:直接结算(立即购买/拼团/秒杀)
|
||||
this.$u.api.settlementOrder({ ifcart: 1, cart_id: id }).then(res => {
|
||||
if(res.errCode == 0) {
|
||||
this.$store.commit('updateCart', res.data)
|
||||
this.$u.route({
|
||||
url: '/pageC/cart/ConfirmOrder',
|
||||
params: {
|
||||
info: JSON.stringify(res.data),
|
||||
}
|
||||
url: '/pageC/cart/ConfirmOrder'
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
63
pageC/groupBuy/index.vue
Normal file
63
pageC/groupBuy/index.vue
Normal file
@@ -0,0 +1,63 @@
|
||||
<template>
|
||||
<view class="group">
|
||||
<view>
|
||||
<u-tabs-swiper ref="uTabs" :list="tabList" :current="current" @change="tabsChange" :is-scroll="false"
|
||||
swiperWidth="750"></u-tabs-swiper>
|
||||
</view>
|
||||
<swiper :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish" >
|
||||
<swiper-item class="swiper-item" v-for="(_, index) in tabList" :key="index">
|
||||
<scroll-view scroll-y style="height: 800rpx;width: 100%;" @scrolltolower="onreachBottom">
|
||||
{{ index }}
|
||||
</scroll-view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import SpecialGoods from "../../components/shop/special-shop/index"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
tabList: [{name: '推荐'}, {name: '推荐'}, {name: '推荐'}],
|
||||
current: 0,
|
||||
swiperCurrent: 0,
|
||||
}
|
||||
},
|
||||
components: {
|
||||
SpecialGoods
|
||||
},
|
||||
onShow() {
|
||||
this.getPinTuanList();
|
||||
},
|
||||
methods: {
|
||||
getPinTuanList() {
|
||||
this.$u.api.getPinTuanList().then(res => {
|
||||
|
||||
})
|
||||
},
|
||||
// tabs通知swiper切换
|
||||
tabsChange(index) {
|
||||
this.swiperCurrent = index;
|
||||
},
|
||||
// swiper-item左右移动,通知tabs的滑块跟随移动
|
||||
transition(e) {
|
||||
let dx = e.detail.dx;
|
||||
this.$refs.uTabs.setDx(dx);
|
||||
},
|
||||
// 由于swiper的内部机制问题,快速切换swiper不会触发dx的连续变化,需要在结束时重置状态
|
||||
// swiper滑动结束,分别设置tabs和swiper的状态
|
||||
animationfinish(e) {
|
||||
let current = e.detail.current;
|
||||
this.$refs.uTabs.setFinishCurrent(current);
|
||||
this.swiperCurrent = current;
|
||||
this.current = current;
|
||||
},
|
||||
// scroll-view到底部加载更多
|
||||
onreachBottom() {
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
</style>
|
||||
85
pageC/spike/index.vue
Normal file
85
pageC/spike/index.vue
Normal file
@@ -0,0 +1,85 @@
|
||||
<template>
|
||||
<view class="spike">
|
||||
<view class="title">
|
||||
<view class="name">全部秒杀</view>
|
||||
<view class="time">
|
||||
<text class="num">{{ seckillTime.littleHour }}</text>
|
||||
<text class="mah">:</text>
|
||||
<text class="num">00</text>
|
||||
<text class="mah">:</text>
|
||||
<text class="num">00</text>
|
||||
<text>-</text>
|
||||
<text class="num">{{ seckillTime.bigHour }}</text>
|
||||
<text class="mah">:</text>
|
||||
<text class="num">00</text>
|
||||
<text class="mah">:</text>
|
||||
<text class="num">00</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="spike-list">
|
||||
<SpecialGoods v-for="(item, index) in spikeList" :key="index" :item="item" type='spike'></SpecialGoods>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import SpecialGoods from "../../components/shop/special-shop/index"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
spikeList: [],
|
||||
page: 0,
|
||||
seckillTime: {}
|
||||
}
|
||||
},
|
||||
components: {
|
||||
SpecialGoods
|
||||
},
|
||||
onShow() {
|
||||
this.getSpikeList();
|
||||
},
|
||||
methods: {
|
||||
// 全部秒杀
|
||||
getSpikeList() {
|
||||
this.$u.api.getSpikeList({ page: this.page }).then(res => {
|
||||
if(res.errCode == 0) {
|
||||
this.spikeList = res.data.list;
|
||||
this.seckillTime = {
|
||||
bigHour: res.data.bigHour,
|
||||
littleHour: res.data.littleHour,
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.spike{
|
||||
min-height: calc(100vh - var(--window-top));
|
||||
padding: 30rpx;
|
||||
border-top: 1rpx solid rgba(236,236,236,1);
|
||||
.title{
|
||||
margin-bottom: 30rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.name{
|
||||
font-size: 30rpx;
|
||||
color: #333;
|
||||
}
|
||||
.time{
|
||||
margin-left: 20rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 20rpx;
|
||||
.num{
|
||||
box-sizing: content-box;
|
||||
width: 25rpx;
|
||||
height: 25rpx;
|
||||
background-color: #bfbfbf;
|
||||
margin: 0 10rpx;
|
||||
padding: 2rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user