Merge pull request '7.16' (#65) from zhy into master

Reviewed-on: http://git.luyuan.tk/luyuan/deming/pulls/65
This commit is contained in:
hansu 2020-07-16 17:40:45 +08:00
commit a0ad70878d
14 changed files with 497 additions and 72 deletions

View File

@ -135,11 +135,12 @@ export default {
});
},
// 选择地区计算运费
getFreight({ freight_hash, city_id, area_id }) {
getFreight({ freight_hash, city_id, area_id, delivery }) {
return vm.$u.post('Buy/change_addr', {
freight_hash: freight_hash,
city_id: city_id,
area_id: area_id,
delivery: delivery,
});
},
// 商品详情
@ -186,6 +187,29 @@ export default {
page: page
});
},
// 拼团列表
getPinTuanList() {
return vm.$u.post('Specialci/pintuanList');
},
// 拼团商品详情
getPinTuanDetails({ pintuan_id }) {
return vm.$u.post('Specialci/pintuanInfo', { pintuan_id: pintuan_id });
},
// 优惠券列表
getCouponList({ page, store_id, type, gc_id }) {
return vm.$u.post('Coupon/CouponList', {
page: page,
store_id: store_id,
type: type,
gc_id: gc_id,
});
},
// 领取优惠券
getCoupon({ vouchertemplate_id }) {
return vm.$u.post('Coupon/getCoupon', {
vouchertemplate_id: vouchertemplate_id,
});
}
}
}

View File

@ -4,16 +4,20 @@ Vue.use(Vuex)
const store = new Vuex.Store({
state: {
count: 0
cartInfo: {}, // 购物车数据
orderAddress: {}, // 下单时选择的地址
},
getters: {
doubleCount (state) {
return state.count * 2
getOrderAddress(state) {
return state.orderAddress;
}
},
mutations: {
increment (state) {
state.count++
updateCart(state, cart) {
state.cartInfo = cart;
},
updateAddress(state, address) {
state.orderAddress = address;
}
}
})

View File

@ -1,6 +1,6 @@
<template>
<view class="items">
<view class="item-top">
<view class="item-top" @click="choiceAddress">
<view class="user-info">
<view class="user-name">{{ item.address_realname }}</view>
<view class="user-pnone">{{ item.address_mob_phone | phoneFormat }}</view>
@ -35,17 +35,15 @@
</view>
</template>
<script>
/**
* address
* @description 地址
* @property {Object} item 地址信息
* @property {String} state 是否选择地址 choise
*/
export default {
name: 'address-item',
data() {
return {
}
},
props: ['item', 'current'],
mounted() {
// console.log(this.item);
},
props: ['item', 'current', 'state'],
filters: {
phoneFormat(value) {
return value.replace(/^(\d{3})\d*(\d{4})$/, '$1****$2');
@ -74,6 +72,15 @@ export default {
}
})
},
choiceAddress() {
if(this.state) {
this.$store.commit('updateAddress', this.item);
this.$u.route({
type: 'navigateBack',
url: '/pageC/cart/ConfirmOrder',
})
}
},
showToast(message, type) {
this.$refs.uToast.show({
title: message,

View File

@ -9,18 +9,59 @@
<view class="item">
<item v-for="item in goodsList" :key="item.goods_id" :info="item"></item>
</view>
<!-- <view>
<u-tabs-swiper ref="uTabs" :list="tabList" :current="current" @change="tabsChange" :is-scroll="false"
swiperWidth="750" height="60"></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%;">
<view class="item">
<item v-for="item in goodsList" :key="item.goods_id" :info="item"></item>
</view>
</scroll-view>
</swiper-item>
</swiper> -->
</view>
</template>
<script>
import item from "./item"
export default {
name:"list",
name:"list",
data() {
return {
tabList: [{name: '推荐'}, {name: '推荐'}, {name: '推荐'}],
tabList: [],
current: 0,
swiperCurrent: 0,
}
},
components:{
item
},
props: {
classifyList: Array,
goodsList: Array,
},
methods: {
// tabsswiper
tabsChange(index) {
this.swiperCurrent = index;
},
// swiper-itemtabs
transition(e) {
let dx = e.detail.dx;
this.$refs.uTabs.setDx(dx);
},
// swiperswiperdx
// swipertabsswiper
animationfinish(e) {
let current = e.detail.current;
this.$refs.uTabs.setFinishCurrent(current);
this.swiperCurrent = current;
this.current = current;
},
}
}
</script>

View File

@ -4,21 +4,25 @@
<view class="title">
<view class="name">全部秒杀</view>
<view class="time">
<text class="num">12</text>
<text class="num">{{ time.littleHour }}</text>
<text class="mah">:</text>
<text class="num">12</text>
<text class="num">00</text>
<text class="mah">:</text>
<text class="num">12</text>
<text class="num">00</text>
<text>-</text>
<text class="num">{{ time.bigHour }}</text>
<text class="mah">:</text>
<text class="num">00</text>
<text class="mah">:</text>
<text class="num">00</text>
</view>
</view>
<view class="next">
<view class="next" @click="viewMore">
查看更多>
</view>
</view>
<view class="list">
<sitem></sitem>
<sitem></sitem>
<sitem></sitem>
<sitem v-for="(item, index) in list.slice(0, 3)" :key="index" :item="item"></sitem>
</view>
</view>
</template>
@ -28,7 +32,15 @@ export default {
name:"seckill",
components:{
sitem
}
},
props: ['list', 'time'],
methods: {
viewMore() {
this.$u.route({
url: '/pageC/spike/index',
})
}
}
}
</script>
<style lang="scss" scoped>
@ -46,15 +58,17 @@ export default {
color: #333;
}
.time{
margin-left: 39rpx;
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;
}
}
}

View File

@ -1,25 +1,33 @@
<template>
<view class="item">
<image class="head"></image>
<text class="title">商品名</text>
<image class="head" :src="item.groupbuy_image1"></image>
<text class="title u-line-2">{{ item.goods_name }}</text>
<view class="price">
<text>99</text>
<text>299</text>
<text>{{ item.groupbuy_price }}</text>
<text>{{ item.goods_price }}</text>
</view>
<view class="info">
<text>剩余21</text>
<text>剩余{{ item.inventory | formatValue }}</text>
<text>立即购买</text>
</view>
</view>
</template>
<script>
export default {
name:"item"
name:"item",
props: ['item'],
filters: {
formatValue(value) {
let temp = Number(value);
if(temp > 999) temp = '999+';
return temp;
}
}
}
</script>
<style lang="scss" scoped>
.item{
width: 210rpx;
width: 220rpx;
.head{
width: 210rpx;
height: 131rpx;
@ -43,6 +51,7 @@ export default {
>text:last-child{
font-size: 24rpx;
color: #999;
text-decoration: line-through;
}
}
@ -50,7 +59,7 @@ export default {
display: flex;
align-items: center;
justify-content: space-between;
font-size: 22rpx;
font-size: 20rpx;
margin-top: 19rpx;
>text:first-child{
color: #666;

View File

@ -0,0 +1,91 @@
<template>
<view class="special">
<image :src="item.groupbuy_image1"></image>
<view class="right">
<view class="name u-line-1">{{ item.goods_name }}</view>
<view class="price" v-if="type == 'spike'">
<view class="groupbuy-price">{{ item.groupbuy_price }}</view>
<view class="goods-price">{{ item.goods_price }}</view>
</view>
<view class="buy">
<view class="num">剩余{{ item.inventory }}</view>
<view class="btn">立即购买</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {}
},
props: {
item: Object,
type: String,
},
created() {
console.log(this.item);
}
};
</script>
<style lang="scss" scoped>
.special {
margin-bottom: 30rpx;
display: flex;
width: 690rpx;
background: rgba(245,245,245,1);
border-radius: 6rpx;
> image {
flex-shrink: 0;
width: 210rpx;
height: 170rpx;
border-radius: 6rpx 0rpx 0rpx 6rpx;
}
.right {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
padding: 20rpx;
.name {
width: 400rpx;
font-size: 26rpx;
color: rgba(51,51,51,1);
margin-bottom: 20rpx;
}
.price {
display: flex;
.groupbuy-price {
font-size: 26rpx;
color: rgba(255,49,49,1);
margin-right: 12rpx;
}
.goods-price {
font-size: 24rpx;
text-decoration: line-through;
color: rgba(153,153,153,1);
}
}
.buy {
display: flex;
justify-content: space-between;
align-items: center;
.num {
font-size: 22rpx;
color: rgba(102,102,102,1);
}
.btn {
width: 140rpx;
height: 50rpx;
background: rgba(255,120,15,1);
border-radius: 25rpx;
font-size: 22rpx;
font-weight: 500;
color: rgba(255,255,255,1);
line-height: 50rpx;
text-align: center;
}
}
}
}
</style>

View File

@ -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'
});
}
},

View File

@ -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
View 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 => {
})
},
// tabsswiper
tabsChange(index) {
this.swiperCurrent = index;
},
// swiper-itemtabs
transition(e) {
let dx = e.detail.dx;
this.$refs.uTabs.setDx(dx);
},
// swiperswiperdx
// swipertabsswiper
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
View 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>

View File

@ -3,7 +3,7 @@
<u-radio-group v-model="current" @change="changeDefault" size="29" active-color="#FF780F">
<u-empty text="暂无收货地址" mode="address" color="#000000" img-width="120" margin-top="300" v-if="!addressList.length"></u-empty>
<view v-for="(item, index) in addressList" :key="index" class="address-item">
<AddressItem :item="item" :current='current' @getAddressList="getAddressList"></AddressItem>
<AddressItem :item="item" :current='current' @getAddressList="getAddressList" :state="state"></AddressItem>
</view>
</u-radio-group>
<view class="address-btn" @click="addAddress">添加地址</view>
@ -16,12 +16,16 @@ export default {
data() {
return {
current: -1, // radio
addressList: []
addressList: [],
state: '', //
}
},
components: {
AddressItem
},
onLoad(option) {
if(option.type) this.state = option.type;
},
onShow() {
this.getAddressList();
},

View File

@ -249,7 +249,6 @@
}
}
}
},
{
"path": "cart/ConfirmOrder",
@ -263,7 +262,32 @@
}
}
}
},
{
"path": "spike/index",
"style": {
"navigationBarTitleText": "全部秒杀",
"app-plus": {
"titleSize": "36px",
"titleNView": {
"titleColor": "#333333",
"backgroundColor": "#FFFFFF"
}
}
}
},
{
"path": "groupBuy/index",
"style": {
"navigationBarTitleText": "全部拼团",
"app-plus": {
"titleSize": "36px",
"titleNView": {
"titleColor": "#333333",
"backgroundColor": "#FFFFFF"
}
}
}
}
]
},

View File

@ -38,8 +38,8 @@
</view>
<view class="hr" style="margin-top:80rpx"></view>
<recommend v-if="JSON.stringify(recommendedSpike) != '{}'" :recommendData="recommendedSpike" type="spike"></recommend>
<view class="hr" style="margin-top:40rpx"></view>
<seckill v-if="spikeList.length"></seckill>
<view v-if="JSON.stringify(recommendedSpike) != '{}'" class="hr" style="margin-top:40rpx"></view>
<seckill v-if="spikeList.length" :list="spikeList" :time="seckillTime"></seckill>
<view v-if="spikeList.length" class="hr" style="margin-top:40rpx"></view>
<recommend v-if="0"></recommend>
<view class="hr" style="margin-top:40rpx" v-if="0"></view>
@ -88,6 +88,7 @@ export default {
goodsList: [],
recommendedSpike: {}, //
spikeList: [], //
seckillTime: {}, //
}
},
onLoad() {
@ -97,6 +98,7 @@ export default {
onShow() {
this.getRecommendedSpike();
this.getSpikeList();
this.getPinTuanList();
},
methods: {
sousuo(){
@ -124,13 +126,25 @@ export default {
getRecommendedSpike() {
this.$u.api.recommendedSpike().then(res => {
if(res.errCode == 0) this.recommendedSpike = res.data;
console.log(this.recommendedSpike);
// console.log(this.recommendedSpike);
})
},
//
getSpikeList() {
this.$u.api.getSpikeList({ page: 0 }).then(res => {
if(res.errCode == 0) this.spikeList = res.data;
if(res.errCode == 0) {
this.spikeList = res.data.list;
this.seckillTime = {
bigHour: res.data.bigHour,
littleHour: res.data.littleHour,
}
}
})
},
//
getPinTuanList() {
this.$u.api.getPinTuanList().then(res => {
})
},
getGoodsRecommend() {